How to remove unclosed lines in a boundary image

조회 수: 6 (최근 30일)
set laura
set laura 2019년 4월 3일
댓글: Akira Agata 2019년 4월 8일
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
set laura
set laura 2019년 4월 3일
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 2019년 4월 8일
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).

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by