How Matlab preserves pictures with white edges in figures

Source: Internet
Author: User

Output image into a directly adjustable grayscale, set the output picture blank margin, and adjust the picture size, aspect ratio.

First, show the picture, Imshow. If it is plot, or newplot, look directly at "three".
Imshow (strain_image, ' border ', ' tight ', ' initialmagnification ', ' fit ');
% ' border ', ' tight ' combination function means to remove the image around the blank
% ' initialmagnification ', ' fit ' combination means that the image fills the entire figure window

Second, set the window size. Just set the window size on the line, the array meaning: [Left bottom width height]. I was set into a square.

Set (GCF, ' Position ', [0,0,512,512])
By the way, the default plot of position is [232 246 560 420]


Third, make the picture fill the whole figure, that is, into the specified shape.
Axis Normal;

The general image that is drawn with the plot function requires only set (GCA, ' position ', [0 0 1 1]) to achieve the purpose, but the Imshow function uses axis image to maintain the proportions of the image, so it must be used with axis Normal change back. The image fills the figure area. Otherwise, the image can only be resized manually, and the whitespace disappears when the scale is appropriate.
If you want to control the interpolation method, you need to use the Imresize command.

Four, save, can only be used in the menu "Save as ..." or the SaveAs command
SaveAs (GCA, ' meanshape.bmp ', ' bmp ');

Summary, is the following four commands:
Imshow (strain_image, ' border ', ' tight ', ' initialmagnification ', ' fit ');
Set (GCF, ' Position ', [0,0,500,500]);
Axis Normal;
SaveAs (GCA, ' meanshape.bmp ', ' bmp ');

Transferred from: http://blog.csdn.net/gxuan/article/details/8768026

How Matlab preserves pictures with white edges in figures

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.