When I use from OpenCV 2.4.2 :
cv::findContours()
This is the output :
How can I get rid of all these irregular shapes and leave only straight lines ?
For this case you can use cvMinAreaRect2. this function gives you a CvBox2D, since the contour you want has the biggest Bounding box the larger box is your goal. also this function can help you to find contours around long lines.
You should use HoughLines
instead of findContours
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With