简体   繁体   English

通过点位置或图像进行角点检测

[英]Corner detection by points location or image

I have some simple shapes which shapes are not necessarily regular. 我有一些简单的形状,这些形状不一定是规则的。 在此处输入图片说明

I need an algorithm to find their corners, actually i want to summarize their points to minimum, to saving them in dxf format and I have their points location in array. 我需要一种算法来找到它们的角,实际上我想将它们的点数最小化,以dxf格式保存它们,并且将它们的点位置放置在数组中。 Simple algorithms like harris or surf do not find proper points and return too much points as result. 诸如harris或surf之类的简单算法找不到合适的点,结果返回的点太多。 Can u please help me to solve this problem by algorithm or idea or code? 您能通过算法,思想或代码来帮助我解决此问题吗? (in c, c#,java ,...) or image processing thanks in advance. (在c,c#,java等中)或图像处理,谢谢。

What you want to achieve is called polygon vectorization . 您想要实现的目标称为多边形矢量化

In the first place, you need to apply a contour following algorithm to get the pixels in sequence. 首先,您需要应用轮廓跟随算法来按顺序获取像素。 In this case, it seems that simply linking the pixels to their neighbor will do (beware that in your sample some of the shapes are open and you probably have to extend the neighborhoods to twoor three pixels. 在这种情况下,似乎简单地将像素链接到它们的邻居就可以了(请注意,在您的示例中,某些形状是开放的,您可能必须将邻域扩展为两个或三个像素。

Then detect the long straight edges by means of the Douglas-Peucker algorithm ( https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm ) or similar. 然后通过Douglas-Peucker算法( https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm )或类似算法来检测长直边。

Some of your corners are blunt and you may want to put them right. 您的某些角落比较钝,您可能需要将它们纠正。 I would suggest to discard the sequences of short segments forming flat angles and join the long adjoining segments to restore square corners. 我建议丢弃形成平角的短段序列,并加入长的相邻段以恢复方形角。

在此处输入图片说明

在此处输入图片说明

Don't expect "perfect" results. 不要期望“完美”的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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