How can I separate objects with one pixel connected after bwlabel
Mostrar comentarios más antiguos
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.
Respuesta aceptada
Más respuestas (2)
load BW
L=watershed(-bwdist(~BW));
BW=BW&L~=0;
imshow(BW)
1 comentario
Zuhui Wang
el 23 de Abr. de 2022
Image Analyst
el 23 de Abr. de 2022
1 voto
You could try imopen() or watershed().
For a thorough discussion, see Steve's blog:
2 comentarios
Zuhui Wang
el 23 de Abr. de 2022
Matt J
el 23 de Abr. de 2022
Seems hard to find a strel that will make imopen work well here.
Categorías
Más información sobre Process Point Clouds en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


