Mar*_*tis 4 opencv computer-vision edge-detection
我编写了提取图像中显示的点的算法。它们形成凸形,我知道它们的顺序。如何从这些点提取角(前3个和后3个)?我正在使用opencv。

如果您已经具有该对象的凸包,并且该包包含角点,那么您要做的就是简化该包,直到它只有6个点。
有很多方法可以简化多边形,例如,您可以只使用此答案中使用的这种简单算法:如何在图像中查找矩形的角坐标
do
for each point P on the convex hull:
measure its distance to the line AB _
between the point A before P and the point B after P,
remove the point with the smallest distance
repeat until 6 points left
Run Code Online (Sandbox Code Playgroud)
如果您不知道确切的点数,则可以删除点,直到最小距离超过特定阈值为止
您也可以执行Ramer-Douglas-Peucker来简化多边形,openCV已经在cv :: approxPolyDP中实现了它。
只需将openCV squares样本修改为使用6点而不是4点
| 归档时间: |
|
| 查看次数: |
3002 次 |
| 最近记录: |