I'm trying to find quads on stream from my webcam. cv2.HoughLinesP sometimes returns more lines then needed. How can I approximate them to contour of exactly 4 points that fits returned result best? I'd like to know the most common way to do this, it looks like an obvious question and I don't want to reinvent the wheel.

enter image description here

  • $\begingroup$ I'm not familiar with what is meant by a "quad". Do you mean a rectangle? Note that coding questions and OpenCV-specific questions are off-topic here, but algorithms and techniques are OK. I suggest showing not only the input image, but also a picture showing the lines that are returned. $\endgroup$ – D.W. May 18 '19 at 19:11
  • $\begingroup$ @D.W. I meant quadrilateral. Returned lines are drawn on this image with random colors. $\endgroup$ – Evgen Vasilev May 20 '19 at 5:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.