2 different imshow() calls send images to same figure?
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Kevin Holly
2021 年 9 月 29 日
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.
回答 (1 件)
yanqi liu
2021 年 9 月 29 日
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 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!