Referencing specific areas of an image

3 views (last 30 days)
matlabjo
matlabjo on 13 Jan 2014
Moved: DGM on 13 Feb 2023
Hi all,
I need to do some template matching in locations that are specified using a binary image. All of the areas that have pixel value of 1 need to be checked. There are several clusters of these.
Using the LOC command i can specify the region of interest , the area I need to search, but how can I find the pixel locations of the ones in the binary image??
Thanks

Answers (2)

Image Analyst
Image Analyst on 13 Jan 2014
[rows, columns] = find(binaryImage);
That gives you the rows and columns of every true pixel in the binary image. Most likely you don't need those (though you think you do) and can just use the binary image itself. I could tell you how, if I only knew what "check" meant.
  6 Comments
Image Analyst
Image Analyst on 14 Jan 2014
Moved: DGM on 13 Feb 2023
You can find the yellow blocks by running my demo http://www.mathworks.com/matlabcentral/fileexchange/28512-simple-color-detection-by-hue. In fact that demo finds yellow so you can run it practically right out of the box. Simply change the filename. You might have to tweak a few threshold somewhat but not much.
Image Analyst
Image Analyst on 14 Jan 2014
Moved: DGM on 13 Feb 2023
Why not just set the blocks level? Why do they have to be all in a jumbled pile? The key to getting good measurements is to always start with the best image possible. If you're looking at the end of a block you can't tell what size it is.

Sign in to comment.


Image Analyst
Image Analyst on 15 Jan 2014
Moved: DGM on 13 Feb 2023
matlabjo, you can just do color segmentation like I said. There is no reason to do edge detection that I can see. And I don't see a reason to do normalized cross correlation either since the shapes are so very different. It won't be that robust in this situation to the various sizes and orientations of the yellow regions. I have a number of color segmentation methods in my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862

Community Treasure Hunt

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

Start Hunting!