How to find if a binary image has some black areas with white holes?

조회 수: 5 (최근 30일)
Michael Shapira
Michael Shapira 2011년 10월 29일
Hi. I have a binary image with a black circle. Inside black circle there is a white cicle. How to find if this my binary image has black elements with a hole inside an element?
I used bwlabel, but don't know what to do with it next
  댓글 수: 1
Image Analyst
Image Analyst 2011년 10월 29일
What is that? A black "element" with a hole in it would be a black region with a white blob in it. Generally black is considered background and white is considered foreground. If you have a white background and black blobs in it and some of the black blobs have white "holes" in them then you'd need to invert your image before doing what Walter says. Otherwise you can just call imclearborder (to get rid of the white background your black circle is sitting on) and see if the sum of the remaining image is greater than zero.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2011년 10월 29일
regionprops() the Euler Number
  댓글 수: 2
Michael Shapira
Michael Shapira 2011년 10월 30일
Thank you. I did as you suggested and extracted the black object
But I have now a new problem, how do I now that it actually has a hole inside. Because , white object can be a line that actually crosses the black object
Image Analyst
Image Analyst 2011년 10월 30일
So you have like two half circles? That would be a black disc with a line cutting across it. How is that a hole? You should post your image somewhere. See http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by