Filling regions in binary image ?

1 回表示 (過去 30 日間)
Jason
Jason 2011 年 7 月 31 日
I have this binary image that is the result of thresholding the saturation component of the HSV image. Link: satImage_afterthreshold
As you can see, before edge detection can be used, I need the regions within the image to be filled. This is what I tried so far, but the outcome isn't pretty.
se = strel('disk', 5); closeBW = imclose(satImage > graythresh(satImage_afterthreshold),se); imtool(closeBW);
Outcome: closeBW After edge detection (Canny):> closeBW_canny
This probably needs a combination of different morphological operations such as imfill, bwareaopen, etc. Any help?
edit01:
Slight enhancement: I used bwareaopen to remove the unwanted pixels on the bottom right of the image. Link: openBW This is the outcome after edge detection: closeBW_canny2 Still, it's not pretty.

採用された回答

Image Analyst
Image Analyst 2011 年 7 月 31 日
After your closing, you should use imfill(). It may never be pretty but since the hand (that's what it looks like to me) is never going to be exactly the same shape anyway, your algorithm must be robust enough to handle slight perturbations in the outline/perimeter. If it can't handle that then it's never going to do what you want (gesture analysis or whatever).
  1 件のコメント
Jason
Jason 2011 年 8 月 3 日
Thanks.

サインインしてコメントする。

その他の回答 (1 件)

yair suari
yair suari 2011 年 7 月 31 日
there used to be a function in the exchange to do just that i dont remember the name but it was something like hfill_nans
  1 件のコメント
Jason
Jason 2011 年 8 月 3 日
Thanks.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by