Filling regon

조회 수: 22 (최근 30일)
Jason
Jason 2011년 5월 4일
Hi. I need ideas on How to fill the dark regions that have white regions inside, to make them completely white. I don't need implementation just ideas of what algorithms or methods I can use to do that. Thanks in advance.
This is the example image: http://i.imgur.com/Fr98t.png

답변 (2개)

Sean de Wolski
Sean de Wolski 2011년 5월 4일
If it would be filled by an:
imfill(X,'holes');
AND is white in the original image; then it might be (Where X has the darker values as true.
It's hard to understand what you mean from that image. Is dark the middle color (grayish) or is it black or is it both?
  댓글 수: 1
Jason
Jason 2011년 5월 4일
Hi. Thanks for your answer. I just replaced the black background to clarify more, look: http://i.imgur.com/kuGBh.png. I just need to completely fill the gray regions with white but only the ones that are already partially filled. This would be the final result: http://i.imgur.com/JFSBB.png

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


Sean de Wolski
Sean de Wolski 2011년 5월 4일
Steps:
  • Do a connected components analysis (bwconncomp) on a logical image of anything you want.
  • Find the linear indeces of all white pixels
  • Use cellfun and ismember to see if, in each connected component there is white (CC.PixelIdxList)
  • if there is, set that entire cell's set of linear indeces to white - else do nothing

Community Treasure Hunt

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

Start Hunting!

Translated by