MATLAB uses the IMAGESC function to display the image, how to come out of the image and the original image ratio is different? __ function

Source: Internet
Author: User
Tags cdata
I use the IMAGESC function to display the image, because the parameter can be added Colorbar function, but the display of the image and the original image scale is not the same, do not know what the reason. Moreover, the size of the digital font on the Colorbar can be changed but a storage, the larger font has been restored. Is it a bug in MATLAB for this feature? It is not appreciated if anyone knows how to solve the problem. kk_2010 (Contact TA in the station) Imagesc (IM2);
Axis image%% Keep picture display ratio


You can refer to this post: http://www.coofish.org/post/284.html

The most basic means of displaying an image is to use the image function. The function also produces a handle to the image object and allows the object's properties to be set. In addition, the IMAGESC function has the function of image, and the difference is that the IMAGESC function automatically scales the input data and displays it in a panchromatic view. Junice (Contact TA within the station) originally posted by kk_2010 at 2011-06-16 1744:
Imagesc (IM2);
Axis image%% Keep picture display ratio


You can refer to this post: http://www.coofish.org/post/284.html

The most basic means of displaying an image is to use the image function. The function also produces a handle to the image object and allows ... If you want to maintain the original ratio to show the full color map how to order. kk_2010 (Contact TA in the station) MATLAB Function Reference ColorMap


Set and get the current ColorMap

Syntax

ColorMap (map)
ColorMap (' Default ')
CMap = ColorMap

% Display and color the new image:
Imagesc (X)
Axis image
ColorMap (bone)

Select the parameters that take advantage of ColorMap. Junice (Contact TA within the station) originally posted by kk_2010 at 2011-06-16 1930:
MATLAB Function Reference ColorMap


Set and get the current ColorMap

Syntax

ColorMap (map)
ColorMap (' Default ')
CMap = ColorMap

% Display and color the new image:
Imagesc (X)
Axis ... I tried, but this is not consistent with the Imshow (X,map) shown on the display, and for some reason, I want the resulting color map to be the same size as the original, not to be displayed after zooming. Thank you for your enthusiasm, though. kk_2010 (Contact TA within the station) does not use IMAGESC because it automatically scales the image data that is being read in.

Use the following method:

Iptsetpref (' imshowaxesvisible ', ' on ')
Imshow (IMG); ColorMap (pink); colorbar; Junice (Contact TA within the station) originally posted by kk_2010 at 2011-06-17 1622:
Do not use IMAGESC because it automatically scales the image data that is being read in.

Use the following method:

Iptsetpref (' imshowaxesvisible ', ' on ')
Imshow (IMG); ColorMap (pink); colorbar; Now the Imshow function in MATLAB shows that the picture size scale is consistent, but why it is not consistent with the size of the picture displayed with the window Photo Viewer. Also, the Colorbar font size changes well and why a store is restored. How to store this display diagram with Colorbar. kk_2010 (Contact TA in the station) refer to the following code: Adjust the length and width to be expanded according to the axes position of the picture, and the font size set by Colorbar.

Img=imread (' cameraman.tif ');
Ratio=size (img,2)/size (img,1);
Imshow (IMG); axis on;
Hcolor=colorbar (' FontSize ', ' n '); axis on;
%%%%%%%%%%
Set (GCA, ' units ', ' pixel ');
H=get (GCF, ' currentaxes ');
Pos=get (H, ' position ');

Set (Hcolor, ' units ', ' pixel ');
Posbar=get (Hcolor, ' position ');

posxy=;
f = getframe (Gcf,posxy);%delete (GCF);
Imwrite (F.cdata, ' color.jpg ');

%%% or something like that.
Img=imread (' cameraman.tif ');
Imshow (IMG); axis on;
Colorbar (' FontSize ', ' n '); axis on
F = getframe (GCF);%delete (GCF);
Imwrite (F.cdata, ' color.jpg '); Junice (Contact TA within the station) originally posted by kk_2010 at 2011-06-18 1603:
Refer to the following code: Adjust the length and width to be expanded according to the axes position of the picture, and the font size set by the Colorbar.

Img=imread (' cameraman.tif ');
Ratio=size (img,2)/size (img,1);
Imshow (IMG); axis on;
Hcolor=colorbar (' ... Thank you for your answer, but I found imshow in full-screen display of the picture as if the picture is enlarged, and imtool can be full-screen without zooming display picture, how can not zoom in the case with imshow full screen display picture. kk_2010 (Contact TA in the station) iptsetpref (' Imshowborder ', ' tight ');
Imshow (I) junice (Contact TA within the station) originally posted by kk_2010 at 2011-06-19 1937:
Iptsetpref (' imshowborder ', ' tight ');
Imshow (i) Although the answer is a bit far from what I want, I have found a solution, thank you for your help. :)

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.