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