Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Getting size of a browsed image

1 visualizzazione (ultimi 30 giorni)
Hassan Bosha
Hassan Bosha il 27 Mar 2019
Chiuso: MATLAB Answer Bot il 20 Ago 2021
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);
}

Risposte (0)

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by