Get quadrilateral from sparse segments
I have a set of segments (each segment is in a std::vector of 2 cv::Point) and if I print them in a image they're arranged in this way:
Most of them are in the two pseudo-parallel lines, other segments are noise. What I want to do is detect the two main lines and build the matching quadrilateral like this:
What is the best approach to solve this problem?
Thanks!