Info
This question is closed. Reopen it to edit or answer.
Getting size of a browsed image
1 view (last 30 days)
Show older comments
I want to take the height and width of the inserted (browsed) picture to use the height and width in a condtion
i'm browsing two pictures , i want the them to have the same size
so i already have the first picture , if the of the size of the second one is equal to the first one, then display it
if it's not resize the second picture with the same of the first one and display it
i'm using GUI
That's my code for browisng button , how can i do it ?
% --- Executes on button press in Browse_Image1.
function Browse_Image1_Callback(hObject, eventdata, handles)
[FileName,PathName] = uigetfile({'*.JPg';'*.tif';'*.gif';'*.png'});
filename = fullfile(PathName,FileName);
myImage1 = imread(filename);
gray1=rgb2gray(myImage1);
% get size of the first one
axes(handles.axes1);
imshow(gray1);
function Browse_Image2_Callback(hObject, eventdata, handles)
if ( Height2 = Height1 && Width2 = Width1)
{
[FileName,PathName] = uigetfile({'*.JPg';'*.tif';'*.gif';'*.png'});
filename = fullfile(PathName,FileName);
myImage2 = imread(filename);
gray2 = rgb2gray(myImage2);
axes(handles.axes2);
imshow(gray2);
}
else
{
[FileName,PathName] = uigetfile({'*.JPg';'*.tif';'*.gif';'*.png'});
filename = fullfile(PathName,FileName);
myImage2 = imread(filename);
gray2 = rgb2gray(myImage2);
grayresiz2 = imresize(gray2,[Height1,Width1]);
axes(handles.axes2);
imshow(grayresiz2);
}
0 Comments
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!