actual size of axes GUI change after uploading IMAGE ASPECT RATIO CHANGE

1 view (last 30 days)
IMAGE ASPECT RATIO CHANGE IMAGE SIZE 1024*768 BUT AFTER UPLOAD SIZE CHANGE ON AXES GUI I HAVE ENCLOSED ERROR SCREEN SHOT.
[image_file_name,image_file_path ] = uigetfile({'*.jpg';'*.avi'},'Please select Frozen Image or Video'); %;*.png;*.yuv;*.bmp;*.tif'},'Pick a file');
handles.image_file_name = image_file_name;
handles.image_file_path = image_file_path;
[pathstr,name,ext] = fileparts(image_file_name)
if(strcmp(ext,'.jpg')||strcmp(ext,'.png'))
if(isequal(image_file_path,0))
msgbox('Please select file');
return;
end
input_image_file = [image_file_path,image_file_name];
handles.temp_image_file = input_image_file;
handles.input_image_file =input_image_file;
% Acquiring Image
img = imread(input_image_file);
[width,height] = size(rgb2gray(img));
handles.img = img;
axes(handles.axes2);
imshow(img);
drawnow;

Answers (1)

Walter Roberson
Walter Roberson on 21 Sep 2017
imshow() tends to resize axes in order to match the image aspect ratio.
If you have an axes whose aspect ratio does not happen to match the image, and you want to force the image to fill the entire axes, then you can do that -- but the result will not have square pixels.
  1 Comment
praveen chandaliya
praveen chandaliya on 21 Sep 2017
can you more detail way explain. suppose initial axes size 400*300 after before uploading image (size of image 600*400) after upload image size convert into (300*250 ). i am getting actual axes size . in scree shot you see that the size of axes in white. after upload size go 20 to 30 % reduce .

Sign in to comment.

Categories

Find more on Printing and Saving in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!