why does `imfill` fill the whole image?

2 ビュー (過去 30 日間)
Ziming Zhong
Ziming Zhong 2017 年 11 月 4 日
コメント済み: Ziming Zhong 2017 年 11 月 9 日
Hi! I converted my image from HSV to bw, and then use `bwareaopen` to eliminate some background noise. After that I still find some 'holes' in the white disks that I need. So I was thinking to use 'imfill' to eliminate the holes. However, after 'infill', I either get a white image showing nothing (this happens when I didn't save the image out and directly called 'imfill' after `bwareaopen`) or the same image as after bwareaopen`. I don't understand why. Could somebody help me out? Thank you!
my codes:
bwIm2=bwareaopen(bwIm,10)
bw=imfill(bwIm2,'holes')

採用された回答

Akira Agata
Akira Agata 2017 年 11 月 6 日
You should delete light area connected to image border before applying imfill. By using imclearborder function before applying imfill, you can obtain the target image, like:
bwTmp = imclearborder(bwIm);
bw = imfill(bwTmp,'holes');
  1 件のコメント
Ziming Zhong
Ziming Zhong 2017 年 11 月 9 日
Thank you!!!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by