二维形状识别与解析算法 [英] 2D Shape recognition and resolving algorithm
问题描述
我正在寻找一种算法,用于从一组给定的(x,y)点中检测矩形,三角形,正方形和圆形等简单形状。我也正在寻找一种方法,一旦发现该问题,便可以将其转换为更整洁的形状。
I'm looking for an algorithm for detecting simple shapes as rectangles, triangles, squares and circles, from a given set of (x,y) points. I'm also looking for a way of, once detected, transform the path to a more clean shape.
我已经在互联网上忙碌了,但没有发现任何简单的方法。
I've scrambled the internet but haven't found any "simple" approaches. Almost all of them are way to advanced for my simple implementation.
预先感谢。
推荐答案
检测到
很可能没有简单的通用方法将点集分类为形状。但是,您可能可以构建一些基本功能,这些功能对于分类许多形状很有用。例如:
There are most likely no simple general approaches for classifying any set of points into a shape. However, there are a few basic functions that you could probably build that will be useful for classifying many of the shapes. For instance:
- 这些点是否形成直线
- 这些点是否形成凸/凹多边形(用于使点失去匹配某些形状的资格)
- 查找点的中心并找到与每个点的中心的距离
- 两点是否共享公共轴
- Whether or not the points form a straight line
- Whether or not the points form a convex/concave polygon (useful for disqualifying points from matching certain shapes)
- Finding center of points and finding distance to center from each point
- Whether or not two points share a common axis
使用上述功能,您应该能够编写一些基本逻辑来对多个形状。
With the above functions, you should be able to write some basic logic for classifying several of the shapes.
这篇关于二维形状识别与解析算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!