![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/177608/image.png)
How can i merge this purple color marked line and remove the line outside of green marked area ?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
After canny edge detection i got this following image. but how can I merge this purple marked line so that other lines will not be effected. and i also want to remove the line outside of green area. how can i do that ?
[ Raw Image]
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166402/image.png)
[marked Image]
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166403/image.png)
0 comentarios
Respuestas (1)
Image Analyst
el 28 de Jul. de 2017
See attached solution.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/177608/image.png)
For linking the bottom lines, you can look at edge linking http://www.peterkovesi.com/matlabfns/#edgelink
Or you could try to do a cluster analysis on the lines and find common y values. Like if you knew there were 9 lines, you could use kmeans to get the centroids in the y direction and then use bwmorph(binaryImage, 'endpoints') to get the endpoints of all the line segments and then use imline() to burn a line connecting endpoints to the closest endpoint of another line in the sane y zone. I don't have code for that but it's pretty straightforward so try it.
9 comentarios
Image Analyst
el 30 de Jul. de 2017
Do you have the Statistics and Machine Learning Toolbox? It's a little easier if you do.
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!