How to remove unclosed lines in a boundary image

8 visualizzazioni (ultimi 30 giorni)
set laura
set laura il 3 Apr 2019
Commentato: Akira Agata il 8 Apr 2019
Hello, everyone. I met a problem when I fused two boundary images from different sources (one is from the function "boundarymask" based on a binary image and another is from canny edge detection). When focusing on one closed polygon, there may exist multiple lines (closed or not closed) internally. So is anyone know how to remove isolated lines within a closed ploygon? Like the following red rectangle region:
there may exist multiple isolated lines in a closed polygon. How to remove it while keeping closed lines which connect to th outer boundary. Please help me. Thanks a lot
  3 Commenti
set laura
set laura il 3 Apr 2019
Thanks a lot. But my question is to remove isolated lines exsiting in an closed boundary while keeping closed lines. If imfill is used, then "closed lines" within this boundary will be ignored.
I tried the following solutions:
1) apply boundarymask to enlarge boundaries. This keeps closed regions.
2) then use imfill to fill gaps and remove isolated lines
but the above method may enlarge the boundaries of the origional image
Akira Agata
Akira Agata il 8 Apr 2019
Thank you for the clarification!
OK, then, how about the second possible solution?
> (2) Calculate Euler number for each region using regionprops function, and then, remove the region whose Euler number = 1 (= region w/o hole = should be isolated line).

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by