如何强制 approxPolyDP() 只返回最好的 4 个角?- Opencv 2.4.2 [英] How to force approxPolyDP() to return only the best 4 corners? - Opencv 2.4.2

查看:511
本文介绍了如何强制 approxPolyDP() 只返回最好的 4 个角?- Opencv 2.4.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题说明了一切

我有一些轮廓,我想从中得到最好的四边形

I have some contour and I want to get the best quadrangular out of it

推荐答案

你必须使用嵌套区间的方法为 epsilon 找到一个合适的值,因为点数随着<代码>epsion.有可能无法达到 4 个角点的值,因为在某个 epsilon 值下,点的数量可能会从 3 跳到 5.

You have to find an appropriate value for epsilon by using the method of nested intervals, since the number of points increases with decreasing epsion. It may be possible, that the value of 4 corner points cannot be reached though, since the number of points may jump from 3 to 5 at a certain value of epsilon.

如果您想排除这种情况,您可能需要自己实现 Ramer-Douglas-Peucker 算法并对其进行修改,因此将返回给定数量的点.(顺便说一下,您要求的是最佳"的 4 个角.您必须指定最佳的含义.approxPolyDp() 并没有声称是最佳解决方案!)

If you want to exclude this case, you might need to implement the Ramer–Douglas–Peucker algorithm yourself and modify it, so a given number of points will be returned. (By the way, you're asking for the 'best' 4 corners. You have to specify what best means. approxPolyDp() does not claim an optimal solution!)

除此之外,我认为没有办法强制 approxPolyDP() 返回 4 分.

Other than that, I see no way to force approxPolyDP() to return 4 points.

这篇关于如何强制 approxPolyDP() 只返回最好的 4 个角?- Opencv 2.4.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆