How can I clean up this image?

6 views (last 30 days)
Tiffany Mao
Tiffany Mao on 23 Jun 2017
Edited: Tiffany Mao on 7 Jul 2017
Why does bwareaopen not work on this image? It gives me seemingly arbitrary chunks of white at the bottom of the image. All help is appreciated.

Answers (1)

Image Analyst
Image Analyst on 24 Jun 2017
Are they always in the same location and of the same size? If so, simply create a mask and mask it. Demo attached.
If the regions are in different locations and different sizes and brightnesses, then you'll have to create a mask from the image which means you'll have to do a better job of explaining what you want to keep, especially for the 3 slivers of white - I still don't know what pixels you're referring to there.
  2 Comments
Walter Roberson
Walter Roberson on 24 Jun 2017
Threshold the image with a relatively high threshold? For example, at (say) 80% of the maximum brightness ?
Image Analyst
Image Analyst on 24 Jun 2017
That didn't answer my question as to whether your blobs are always the same size and location. Please answer.
The big blob on the left is pretty easy. Simply use imclose(), then threshold and use bwareafilt() to extract the largest blob.
But I still don't know where the edges of the small slivers are. Have you looked at the histogram? Where would you want to threshold it? What if some small noise specks are brighter than the "slivers"? Keep those instead? Do you need to filter based on shape? Like aspect ratio?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!