Binary Image enclosed Area

1 次查看(过去 30 天)
Ian Hersom
Ian Hersom 2016-8-1
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.

回答(1 个)

Image Analyst
Image Analyst 2016-8-1
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 个评论
Ian Hersom
Ian Hersom 2016-8-1
Let me clarify. I want to find the boundaries, so that I can use the enclosed area.
Image Analyst
Image Analyst 2016-8-1
编辑:Image Analyst 2016-8-1
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.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by