Binary Image enclosed Area

6 views (last 30 days)
Ian Hersom
Ian Hersom on 1 Aug 2016
Edited: Image Analyst on 1 Aug 2016
I am attempting to search within the boundaries of the ones in the attached binary image. I need to somehow find all the indices of the enclosed area in the binary image so I can search in the actual RGB image itself. I've tried using "edges" "boundary" etc. To clarify, I'm looking to use the information inside of the edges of the boundary.

Answers (1)

Image Analyst
Image Analyst on 1 Aug 2016
Just use find():
[rows, columns] = find(binaryImage);
rows and columns will be vectors of the rows and columns (matched up) of every single white pixel in your binary image.
Other than that I'm not sure what you want because of the two situations you stated: one where you said you want the boundaries (perimeters) and the other where you said you wanted the enclosed coordinates. Is it one or the other or both?
I'm also unsure exactly what "search within" and "search in" means. Search for what?
You have hundreds of blobs there. If you just want the pixels inside each blob, but not on the boundary itself, then call imerode() to eat away one layer of pixels from all blobs. What's left will be just the "inside".
  2 Comments
Ian Hersom
Ian Hersom on 1 Aug 2016
Let me clarify. I want to find the boundaries, so that I can use the enclosed area.
Image Analyst
Image Analyst on 1 Aug 2016
Edited: Image Analyst on 1 Aug 2016
That's not clarified. What does "use" or "search in" mean? If you just want the boundaries, you can use bwboundaries(). But since you haven't said the boundaries of what - each blob or the cluster of blobs - you might need activecontour(). A demo is attached.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!