How to remove small CLUTTER from images?

6 ビュー (過去 30 日間)
Steven
Steven 2014 年 2 月 8 日
編集済み: Steven 2014 年 2 月 9 日
Hi.
How can I remove small clutters in an image? For example in the following image (this is a binary one obtained from the original gray scale image):
I want to remove the sections specified by red regions in this image:
I tried "bwareaopen", but it fills the holes, while I do not want to fill the holes, but want to remove small clutters.
By removing, I mean make those regions WHITE!
P.S., I can do filtering either in grayscale or binary image. Which one is better?
Thanks so much.
Steven

採用された回答

Image Analyst
Image Analyst 2014 年 2 月 9 日
Well the bottom one is bigger than 70 or whatever size you picked. And the others are not holes, but are part of the background that just happens to jut far into the foreground. You can try to get rid of those in two ways but it's not easy. You can use active contour, then fill that, exclusive or that with the original, and use bwareaopen again to get rid of large blobs. Or you can use imclose() but that will affect the shape of the fine details on the boundary.
Honestly I don't think it will make a big difference whether they are in there or not. There's probably way more variation in what your foreground looks like than in those small things. You're trying to get to an accuracy of 10 pixels or so for a particular image, but then the next image will have a foreground different by tens of thousands of pixels. I don't think it will affect whatever decisions you're going to make based on these measurements, like if the material passes or fails. Don't sweat the small stuff.
  2 件のコメント
Steven
Steven 2014 年 2 月 9 日
Thanks for your answer. I am looking for the area of black region.
I also think that those left there (after using bwareaopen) may not affect the result, so I may ignore them!
Thanks again so much my friend.
Steven
Image Analyst
Image Analyst 2014 年 2 月 9 日
numBlackPixels = sum(~binaryImage(:));

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

その他の回答 (1 件)

Spandan Tiwari
Spandan Tiwari 2014 年 2 月 8 日
BWAREAOPEN assumes that the objects are white. In your case the objects (regions that you want to remove) are black. So first complement the image using IMCOMPLEMENT, then use BWAREAOPEN to remove the regions, and then use IMCOMPLEMENT to go back to the original polarity.
  5 件のコメント
Steven
Steven 2014 年 2 月 9 日
Thanks all for your comments. As "Image Analyst" and "Anand" said, I have misused of bwareaopen value.
Now, I can almost remove all of unwanted clutters with small values, although some of them will still remain. If I increase the value, it will fill some of small regions (that should not be filled!) as well. I think I have to remove them manually. Right?
Thanks again.
Steven
Image Analyst
Image Analyst 2014 年 2 月 9 日
No, you shouldn't have to remove any manually. Please attach photos showing before and after and indicate which clutter remained that you want to get rid of and think you need to do it manually.

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

カテゴリ

Help Center および File ExchangeAgriculture についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by