查找图像中扭曲的矩形(OpenCV)
我正在寻找正确的算法集来解决此图像处理问题:
- 我有一个包含扭曲矩形的扭曲二值图像
- 我需要找到该矩形的 4 个角点的良好近似值
我可以使用 OpenCV 计算轮廓,但是由于图像扭曲,它通常会包含 4 个以上的角点。 是否有一个好的近似算法(最好使用 OpenCV 运算)来使用二值图像或轮廓描述找到矩形角点?
图像如下所示:
谢谢!
丹尼斯
I am looking for the right set of algorithms to solve this image processing problem:
- I have a distorted binary image containing a distorted rectangle
- I need to find a good approximation of the 4 corner points of this rectangle
I can calculate the contour using OpenCV, but as the image is distorted it will often contain more than 4 corner points.
Is there a good approximation algorithm (preferably using OpenCV operations) to find the rectangle corner points using the binary image or the contour description?
The image looks like this:
Thanks!
Dennis
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
使用 cvApproxPoly 函数消除轮廓的节点数量,然后过滤掉那些具有太多节点或角度与 90 度相差很大的轮廓。另请参阅类似答案
Use cvApproxPoly function to eliminate number of nodes of your contour, then filter out those contours that have too many nodes or have angles which much differ from 90 degrees. See also similar answer
略有不同的答案,请参阅
http://opencv.willowgarage.com/documentation/cpp/camera_calibration_and_3d_reconstruction。 html
little different answer, see
http://opencv.willowgarage.com/documentation/cpp/camera_calibration_and_3d_reconstruction.html
看opencv函数ApproxPoly。它从轮廓近似多边形。
Look at the opencv function ApproxPoly. It approximates a polygon from a contour.
尝试哈里斯角探测器。 OpenCV 包中有示例。您需要使用图像的参数。
并查看其他 OpenCV 算法: http://www.comp.leeds .ac.uk/vision/opencv/opencvref_cv.html#cv_imgproc_features
Try Harris Corner Detector. There is example in OpenCV package. You need to play with params for your image.
And see other OpenCV algorithms: http://www.comp.leeds.ac.uk/vision/opencv/opencvref_cv.html#cv_imgproc_features
我会尝试广义霍夫变换,它有点慢,但可以很好地处理扭曲/不完整的形状。
http://en.wikipedia.org/wiki/Hough_transform
I would try generalised Hough Transform it is a bit slow but deals well with distorted/incomplete shapes.
http://en.wikipedia.org/wiki/Hough_transform