Hausdorff距离的替代指标 [英] Alternative metric for Hausdorff distance
问题描述
对于我的项目,我需要基于OBJ文件测量两个3D网格之间的距离.我必须实现两个不同的指标并进行比较.在我的文献研究过程中,到目前为止,我仅发现Hausdorff距离作为度量.显然,Hausdorff距离可用于计算3D网格的距离.
For my project, I need to measure the distance between two 3D meshes based on OBJ-Files. I have to implement two different metrics and compare them. In the course of my literature research, I have so far found only the Hausdorff distance as a metric. Apparently, the Hausdorff distance can be used to calculate the distance of 3D meshes.
是否有足够的Hausdorff距离替代方法?
该主题与我的主题类似,但是我想实现两个不同的指标.测量网格之间的距离
This topic is similiar to mine, but i want to implement two different metrics. Measure distance between meshes
推荐答案
很多.视您的情况而定.
Many. Depends on your case.
Hausdorff距离是它是从一组中的点到另一组中的最接近点的所有距离中的最大者".来自维基百科
Hausdorff distance is "it is the greatest of all the distances from a point in one set to the closest point in the other set." from wikipedia
考虑下面两个二维的示例(u和v):
Consider the below example of two sets (u and v) in 2 dimensions:
from scipy.spatial.distance import directed_hausdorff
import numpy as np
u = np.array([(1.0, 0.0),
(0.0, 1.0),
(-1.0, 0.0),
(0.0, -1.0)])
v = np.array([(2.0, 0.0),
(0.0, 2.0),
(-2.0, 0.0),
(0.0, -4.0)])
print(directed_hausdorff(u, v))
(2.23606797749979, 3, 0)
根据您所拥有的组:2.23606797749979或3.
Depending on the group you have: 2.23606797749979 or 3.
回到定义,我可以使用欧几里得距离轻松地重现该结果.
Going back to the definition I can easily reproduce that results using euclidian distance.
print(euclidean_distances(u, v).min(axis = 0).max(axis = 0))
print(euclidean_distances(u, v).min(axis = 1).max(axis = 0))
3.0
2.23606797749979
让我们看看两组中所有点之间的所有距离:
Let have a look to all the distances between all the points of the two sets:
print(euclidean_distances(u, v))
[[1. 2.23606798 3. 4.12310563]
[2.23606798 1. 2.23606798 5. ]
[3. 2.23606798 1. 4.12310563]
[2.23606798 3. 2.23606798 3. ]]
例如,您可以看到最远的距离是1,最长的距离是5.我可以将其形式化如下:
As you can see the sortest distance is 1 and the longest 5 for instance. I could formalize that as follow:
print(np.max(euclidean_distances(u, v)))
print(np.min(euclidean_distances(u, v)))
5
1
我也可以取平均值:
print(np.mean(euclidean_distances(u, v)))
2.603913694764629
如您所见,那里有不同的选择.
As you see, you have different alternatives there.
这篇关于Hausdorff距离的替代指标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!