Im trying to segment an image into three categories using Matlab Image Segmenter.
The raw image:

Three categories are as follows: 1. Large white shapes 2. Small white shapes 3. Background
I have managed to segment Large shapes using tresholding and morphology options.

And backround using tresholding and inverse mask

However I don't know how to segment small shapes from the image. Morphology option allows to segment shapes larger than some treshold value, but does not allow to segment shapes smaller than treshold value, or in between.
I need to treshold more than 100 of these images so manual filling is not an option.
Here is one solution. If your other segmentation steps already work, you can export all the steps to a function. Save function, and just add the logic yourself. If BW1 corresponds to the large shapes, BW2 to the background, then the small shapes correspond to:
BW3 = ~(BW1 | BW1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With