How can I show a "found" pixel in an image?

Hi. I use find command for different things, like for finding max,(max(I(:))), like for finding specific corners, etc. How can I show the found pixel in image? It gives me numbers. How can I show it in image with a red dot, a marker, over the image?

 Accepted Answer

imshow() shows all the pixels in the entire image, including the one you want. If you want a red cross in the overlay above your image, do this
imshow(rgbImage);
hold on;
plot(x, y, 'r+', 'LineWidth', 2, 'MarkerSize', 30); % Put up red cross.
% If you want a blue circle instead, try this:
plot(x, y, 'bo', 'LineWidth', 2, 'MarkerSize', 30); % Put up blue circle.
% If you want a yellow square instead, try this:
plot(x, y, 'ys', 'LineWidth', 2, 'MarkerSize', 30); % Put up blue circle.
If your data is in terms of row, column rather than x,y, then make sure you do plot(column, row, 'r+'), and NOT plot(row, column, 'r+')

6 Comments

thank you so much for your answer,i segmented an image,now i have a binary image,and im going to find its upper left,upper righ...corners,.im going to see where they locate and base on them i can see whether my segmentation is right or should segemnted more,.i tried this,(corners are one of your answers)
if true
binaryImage=bwareaopen(Ibw,70000);
upperLeftCornerX = find(binaryImage(1,:), 1, 'first');
upperRightCornerX = find(binaryImage(1,:), 1, 'last');
lowerLeftCornerX = find(binaryImage(end,:), 1, 'first');
lowerRightCornerX = find(binaryImage(end,:), 1, 'last');
imshow(binaryImage);
hold on;
plot( columns, row,'r+', 'LineWidth', 2, 'MarkerSize', 30); % Put up red cross.
and it gives me this error:Undefined function or variable 'columns'.
and the binary image is the image i segmentated,using some filters...should i use its label?i mean should i detect thise corners on the labeled image,or binary image works too?
No, that looks all wrong in lots of ways. Besides, your binary image shows you the segmentation already . If you want to see it over your original image, why not just call bwboundaries() to plot your blob outlines over the original image, like I did in my Image Segmentation Tutorial: http://www.mathworks.com/matlabcentral/fileexchange/25157-image-segmentation-tutorial?
with bwboundaries,can i see these corners too?use these codes on boudary>?
No, it does the actual outlines of the binary blobs, not bounding boxes. If you want bounding boxes you need to use regionprops (if you have any more than one blob in the image). And then, again, see my Image Segmentation Tutorial. I do it both ways - outlines and bounding boxes.
thank you so much
You're welcome. If we're done here, can you mark the Answer as "Accepted"? Thanks in advance.

Sign in to comment.

More Answers (0)

Categories

Tags

Asked:

on 11 Apr 2015

Commented:

on 12 Apr 2015

Community Treasure Hunt

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

Start Hunting!