Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Getting size of a browsed image

1 回表示 (過去 30 日間)
Hassan Bosha
Hassan Bosha 2019 年 3 月 27 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by