Find and eliminate (near-) parallel line segments

asked 2018-07-02 07:07:48 -0500

Grillteller gravatar image

updated 2018-07-02 07:14:43 -0500


is there are smart way to find and eliminate parallel line segments in opencv. I found some line segments using the LineSegmentDetector (LSD) of opencv. I get some results like this: Image 1a

Image 2a

Now I want to merge these single segments into one or two segments like e.g. here (marked in red): Image 1b Image 1c

Image 2b

I have the angle, start- and endpoint and length of my linesegment. Is there are smart way to do it without iterating through all the line segments and comparing the slope and intercept of? The linesegments are stored in a vector<Vec4f>.

edit retag flag offensive close merge delete


Yeah, I found that thread after posting it here. Should work out quite well and there is even a new solution from 2 days ago that is very detailed. I will basically follow these instructions. Thanks!

Grillteller gravatar imageGrillteller ( 2018-07-04 02:43:25 -0500 )edit