How to remove unclosed lines in a boundary image
2 views (last 30 days)
Show older comments
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 Comments
Akira Agata
on 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).
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!