简体   繁体   中英

OpenCV 2.4.2 findContours(), how to get only the straight lines contours

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.

您应该使用HoughLines而不是findContours

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM