Hausdorff 距离的替代度量 [英] Alternative metric for Hausdorff distance

查看:36
本文介绍了Hausdorff 距离的替代度量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的项目,我需要基于 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屋!

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