How to mark image with respect to given logical mask?

3 ビュー (過去 30 日間)
Himanshu Meena
Himanshu Meena 2020 年 10 月 18 日
コメント済み: Ameer Hamza 2020 年 10 月 18 日
I've an image and a logical mask produced from same image. I wish to mark all the pixels on original image with respect to the pixels which are 1 in logical mask. This was my solution:
%'img' is original image. 'Icornr' is the logical mask. 'Ioverlay is the image I wish to output.
Ioverlay = imoverlay(img, Icornr, [1 0 1]);
imshow(Ioverlay);
axis equal tight on;
title('Harris Corner overlayed on Original');
colorbar;
This is the output I get where ROI are marked with magneta. What I wish to accomplish is to rather than marking the pixels with . they should be marked with + or x. An example of such is given below:

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 10 月 18 日
Try something like this
img = imread('pears.png');
Icornr = rand(size(img, [1 2])) > 0.995; % example mask
figure();
ax1 = axes();
Ioverlay = imoverlay(img, Icornr, [1 0 1]);
imshow(Ioverlay, 'Parent', ax1);
axis equal tight on;
title('Harris Corner overlayed on Original');
colorbar;
figure();
ax2 = axes();
hold on
[r, c] = find(Icornr);
imshow(img, 'Parent', ax2);
plot(ax2, c, r, '+');
axis equal tight on;
title('Harris Corner overlayed on Original');
colorbar;
  2 件のコメント
Himanshu Meena
Himanshu Meena 2020 年 10 月 18 日
Yes, The second output is exactly what I was looking for.
Ameer Hamza
Ameer Hamza 2020 年 10 月 18 日
I am glad to be of help!

サインインしてコメントする。

その他の回答 (0 件)

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by