Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Getting size of a browsed image

1 visualización (últimos 30 días)
Hassan Bosha
Hassan Bosha el 27 de Mzo. de 2019
Cerrada: MATLAB Answer Bot el 20 de Ag. de 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);
}

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by