2 different imshow() calls send images to same figure?
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm trying to open 2 separate figures and display a grayscale image in each figure using imshow. However, when I do so, the title of my first image is removed, but not the image itself. Figure(1) is also renamed to figure(2) while what I want to be figure(2) is named figure(1).
I think the issue is that imshow is displaying temp3 on both figure(1) and figure(2), but I don't understand why this would be happening. What should I change to ensure that I get the behavior I want (both images have their proper titles and figure labels)? Here's the code:
figure(1)
imshow(mat2gray(temp2));
title('After background subtraction and image thresholding')
figure(2)
imshow(mat2gray(temp3)); hold on
title('After peak detection')
scatter(good(1:no_good, 2), good(1:no_good, 1), 60, 'red')
impixelinfo;
hold off;
3 comentarios
Lakshay Sood
el 28 de Sept. de 2021
Editada: Lakshay Sood
el 28 de Sept. de 2021
Kevin Holly
el 29 de Sept. de 2021
I'm not sure why you are having an issue. You can name your figures if that will help you resolve the issue.
fh1 = figure('Name','Window 1')
imshow(mat2gray(temp2));
title('After background subtraction and image thresholding')
fh2 = figure('Name','Window 2')
imshow(mat2gray(temp3)); hold on
title('After peak detection')
scatter(good(1:no_good, 2), good(1:no_good, 1), 60, 'red')
impixelinfo;
hold off;
Are you selecting or moving the figures manually before running commands or are you running all the command at once?
In the code given, there is no instance of you using imshow for temp1 or temp4.
Respuestas (1)
yanqi liu
el 29 de Sept. de 2021
figure('Name', 'demo1', 'NumberTitle', 'off')
imshow(mat2gray(temp2));
title('After background subtraction and image thresholding')
figure('Name', 'demo2', 'NumberTitle', 'off')
imshow(mat2gray(temp3)); hold on
title('After peak detection')
scatter(good(1:no_good, 2), good(1:no_good, 1), 60, 'red')
impixelinfo;
hold off;
0 comentarios
Ver también
Categorías
Más información sobre Display Image 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!