Calculating the similarity of 2 sets of convex polygons?

安稳与你 提交于 2021-02-11 12:17:48

问题


I have generated 2 sets of convex polygons from with different algorithms. Every polygon in each set is described by an array of coordinates[n_points, xy_coords], so a square is described by an array [4,2] but a pentagon with rounded corners has [80,2], with the extra 75 points being used to describe the curvatures.

My goal is to quantify how similar the two sets of geometries are.

Can anyone recommend any methods of doing so?

So far I've come across:

  • Hamming Distance
  • Hausdorff distance

I would like to know what other robust measures of similarity for 2D polygons. The method ideally needs to be robust across convex polygons and and give a measure of similarity between large sets (10,000+ each).


回答1:


Assuming that both polygons are aligned, centered and convex you could try to assess similarity by computing ratio of area a smaller polygon to area of convex hull of both polygons.

Ratio = Min(Area(A), Area(B)) / Area(ConvexHull(A, B))

The ratio will be 1 if both polygon are equal, and 0 if the differ severely like a point and a square.

Area of the polygon can be computed in O(N) time. See Area of polygon. The convex hull can be computed in O(N log N). See Convex Hull Computation. It could be speed up to O(N) by merge-sorting already sorted vertices of both polygons and applying the second phase of Graham Scan Algorithm.



来源:https://stackoverflow.com/questions/62414568/calculating-the-similarity-of-2-sets-of-convex-polygons

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!