Binary Image enclosed Area

조회 수: 2 (최근 30일)
Ian Hersom
Ian Hersom 2016년 8월 1일
편집: Image Analyst 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