필터 지우기
필터 지우기

fill in missing or incorrect data in skeletonized image

조회 수: 1 (최근 30일)
Andrew Luce
Andrew Luce 2020년 4월 4일
답변: Image Analyst 2020년 4월 4일
Hello,
I have a skeletonized line that meanders. However, the corners of the line are eiher missing or are not straight. I was wondering if there was any matlab function or techniques that could be used to either straighten out the corners or a add the missing points. I attached the data for it.
Thank you
Andrew

답변 (1개)

Image Analyst
Image Analyst 2020년 4월 4일
You could remove all single pixels with bwareafilt, then call imdilate with a vertical and horizontal structuring element.
mask = bwareafilt(mask, 4, [2, inf]); % Remove single, 4-connected dots.
mask = imdilate(mask, [1,1,1]); % Widen lines by one pixel on each end.
mask = imdilate(mask, [1;1;1]); % Heighten lines by one pixel on each end.

Community Treasure Hunt

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

Start Hunting!

Translated by