从凸点获得拐角 [英] Getting corners from convex points

查看:599
本文介绍了从凸点获得拐角的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了算法来提取图像中显示的点。它们形成凸形,我知道它们的顺序。如何从这些点提取角点(顶部3和底部3)?
我使用opencv。



解决方案

如果你已经有对象的凸包,并且船体包括角点,要做的是简化船体,直到它只有6点。



有很多方法来简化多边形,例如你可以使用这个简单的算法:如何查找图片中矩形的角坐标



<$对于凸包上的每个点P,p $ p> do

测量其与P之前的点A和点B之间的线AB _
的距离在P之后,
删除具有最小距离的点
重复,直到6点左

如果你不知道确切的点数,那么你可以删除点,直到最小距离超过一定阈值



你也可以 Ramer-Douglas-Peucker 来简化多边形,openCV已经实现了 cv :: approxPolyDP



只需修改 openCV正方形示例使用6点而不是4


I have written algorithm to extract the points shown in the image. They form convex shape and I know order of them. How do I extract corners (top 3 and bottom 3) from such points? I'm using opencv.

解决方案

if you already have the convex hull of the object, and that hull includes the corner points, then all you need to to do is simplify the hull until it only has 6 points.

There are many ways to simplify polygons, for example you could just use this simple algorithm used in this answer: How to find corner coordinates of a rectangle in an image

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

If you do not know the exact number of points, then you could remove points until the minimum distance rises above a certain threshold

you could also do Ramer-Douglas-Peucker to simplify the polygon, openCV already has that implemented in cv::approxPolyDP.

Just modify the openCV squares sample to use 6 points instead of 4

这篇关于从凸点获得拐角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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