Filling gaps in between lines to make it a continuous line
이전 댓글 표시
Can anyone suggest a method ... How to fill the gaps in between the small edge detected lines in the image to make it a continuous line. Here is my image link
채택된 답변
추가 답변 (3개)
Image Analyst
2011년 10월 15일
1 개 추천
Skeletonize the white blobs. Then find the endpoints with bwmorph(,'endpoints'). Connect each endpoint to the closest other endpoint that it is not already connected to by using imline.createmask(). Write back if you need a demo on using imline to write lines into the image.
댓글 수: 5
Walter Roberson
2011년 10월 15일
I did consider the possibility of connecting the endpoints, but then I noticed that the lines being joined are not really straight, and I got side-tracked into considerations of extending the existing curvature to reach the endpoint, and considerations of smoothness of the transition to the joining segment (probably obvious corners at the join are not very desirable.)
I think it was about at that point that my mind said, ".... Hmmmm, Donut!!" and promptly discarded the train of thought on the grounds that it was interfering with the procurement of junk food. ;-)
Image Analyst
2011년 10월 15일
Yeah, you're right. It may or may not be an issue with him.
Walter Roberson
2011년 10월 15일
True. There _are_ some people immune to the siren call of donuts. :)
Walter Roberson
2011년 10월 15일
Ah! He could feed in the coordinates of the existing pixels on both ends (or a subset of that), run a cubic spline, and use that to interpolate the connecting line segment. Smoothness solved!
Gova ReDDy
2011년 10월 18일
Walter Roberson
2011년 10월 14일
0 개 추천
Depending on how large of a gap you want to fill, imdilate() might be appropriate.
Dr. Seis
2011년 10월 18일
0 개 추천
If you want to do this in 2D, then I think using "interp2" with the "spline" option will only work for input located on a regular spaced grid. I don't think it is designed to work if there is any irregularity or are any "holes" in the data. However, the solution posted on:
will allow one to run a spline (albeit a biharmonic spline) through data located on an irregular grid (or a regular grid with "holes").
If you ask for the output from the function (given on the page above) to fall on a regular grid corresponding to the same locations as the input data, then those points should be exactly the same and should only fill in the "holes" in your data. This should be the case with any spline for any dimension.
댓글 수: 3
Gova ReDDy
2011년 10월 18일
Stelios Fanourakis
2019년 8월 10일
I need this info as well. How to fill gaps with imline.createmask() after finding the endpoints using bwmorph
Image Analyst
2019년 8월 10일
See attached demo and adapt as needed.
카테고리
도움말 센터 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
