필터 지우기
필터 지우기

How to delete the branches?

조회 수: 9 (최근 30일)
rui gao
rui gao 2019년 9월 23일
댓글: rui gao 2019년 10월 4일
111.png
I have a matrix which just consist by 0 and 1, like the figure above (1 is black and 0 is white). It's kind of river, but there is some noise like the red arrows above.
Is there some ways to identify these small segment lines and delete these small segment lines?
Calculating the length (pixel) of these small segment lines is not necessary, but I am interested to know it.
Any suggestion will be appreciated.

채택된 답변

rui gao
rui gao 2019년 9월 23일
Maybe I can delete these segment lines in ArcGIS as the small segment lines can be identified as short length.
  댓글 수: 4
darova
darova 2019년 9월 23일
See if bwmorph can manage it
I1 = bwmorph(I,'spur',inf)
rui gao
rui gao 2019년 9월 24일
WeChat Image_20190923190308.png
Oops, for this kind of situation, the left red line should be remained, but it was deleted.
Maybe, we should add something ???

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

추가 답변 (1개)

darova
darova 2019년 9월 24일
I have an idea:
  • Find pairs of branch/end points smaller than desired length
  • Select circle area between points. Find biggest area in this circle (if there are) and remove it
  • Place modificated circle area into original image
1Untitled.png
See the attached script
  댓글 수: 12
darova
darova 2019년 10월 4일
Sure, see attached script
Just pick some points to add lines (press Enter to finish)
rui gao
rui gao 2019년 10월 4일
Thank you so much.

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

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by