Filling gaps in between lines to make it a continuous line
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (3)
Image Analyst
el 15 de Oct. de 2011
1 voto
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 comentarios
Walter Roberson
el 15 de Oct. de 2011
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
el 15 de Oct. de 2011
Yeah, you're right. It may or may not be an issue with him.
Walter Roberson
el 15 de Oct. de 2011
True. There _are_ some people immune to the siren call of donuts. :)
Walter Roberson
el 15 de Oct. de 2011
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
el 18 de Oct. de 2011
Walter Roberson
el 14 de Oct. de 2011
0 votos
Depending on how large of a gap you want to fill, imdilate() might be appropriate.
Dr. Seis
el 18 de Oct. de 2011
0 votos
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 comentarios
Gova ReDDy
el 18 de Oct. de 2011
Stelios Fanourakis
el 10 de Ag. de 2019
I need this info as well. How to fill gaps with imline.createmask() after finding the endpoints using bwmorph
Image Analyst
el 10 de Ag. de 2019
See attached demo and adapt as needed.
Categorías
Más información sobre Region and Image Properties en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
