Display original and processed image simultaneously in different UIAxes in App Designer
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Beth Carreon
el 24 de Abr. de 2022
Comentada: Beth Carreon
el 25 de Abr. de 2022
Is it possible to display the original image and processed image in GUI simultaneously? I have this code below and the result is that the images appear alternately. And the code stops after 1 image.
filePattern = fullfile(app.myFolder, '*.JPG'); % Change to whatever pattern you need.
theFiles = dir(filePattern);
for k = 1 : length(theFiles)
baseFileName = theFiles(k).name;
fullFileName = fullfile(theFiles(k).folder, baseFileName);
% Now do whatever you want with this file name,
% such as reading it in as an image array with imread()
OrigImage = imread(fullFileName);
imshow(OrigImage, 'Parent', app.UIAxes); % Display image.
drawnow; % Force display to update immediately.
pause(1);
while k >= 1
a = rgb2gray(OrigImage);
imshow(a, 'Parent', app.UIAxes_2);
drawnow; % Force display to update immediately.
pause(1);
end
end
0 comentarios
Respuesta aceptada
DGM
el 24 de Abr. de 2022
Editada: DGM
el 24 de Abr. de 2022
The images appear alternately because that's what the code plainly does. It shows one image, waits, shows another.
It doesn't stop after one image. It gets stuck in an infinite loop. There is no reason for this to be in a while loop, so just remove the loop.
while k >= 1
a = rgb2gray(OrigImage);
imshow(a, 'Parent', app.UIAxes_2);
drawnow; % Force display to update immediately.
pause(1);
end
3 comentarios
DGM
el 25 de Abr. de 2022
The pause(1) lines make the code wait for 1 second. If you don't want it to pause, don't use pause().
Más respuestas (0)
Ver también
Categorías
Más información sobre Desktop en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!