How can I separate objects with one pixel connected after bwlabel
Show older comments
Hi,
I am using bwlabel to label the objects with defined connectivity after edge detection algorithm. But sometimes I encountered the objects are connected with only one pixel. How could I efficiently separate them?
Below is one example of a binary image I want to detect objects. I chose connectivity 4 to detect the objects when using bwlabel
obj_label = bwlabel(BW, 4);
Actually these two are seperate objects that I want, but the one pixel between make them difficult to label when using bwlabel.

Appriciate a lot if any suggestions are provided.
Accepted Answer
More Answers (2)
Image Analyst
on 23 Apr 2022
1 vote
You could try imopen() or watershed().
For a thorough discussion, see Steve's blog:
2 Comments
Zuhui Wang
on 23 Apr 2022
Matt J
on 23 Apr 2022
Seems hard to find a strel that will make imopen work well here.
Categories
Find more on Object Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

