當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python skimage.metrics.hausdorff_distance用法及代碼示例

用法:

skimage.metrics.hausdorff_distance(image0, image1)

計算給定圖像的非零元素之間的 Hausdorff 距離。

Hausdorff 距離 [1]image0 上的任意點與其在 image1 上的最近點之間的最大距離,反之亦然。

參數

image0, image1ndarray

True 表示包含在一組點中的點的數組。兩個數組必須具有相同的形狀。

返回

distance浮點數

image0image1 中非零像素坐標之間的 Hausdorff 距離,使用歐幾裏得距離。

參考

1

http://en.wikipedia.org/wiki/Hausdorff_distance

例子

>>> points_a = (3, 0)
>>> points_b = (6, 0)
>>> shape = (7, 1)
>>> image_a = np.zeros(shape, dtype=bool)
>>> image_b = np.zeros(shape, dtype=bool)
>>> image_a[points_a] = True
>>> image_b[points_b] = True
>>> hausdorff_distance(image_a, image_b)
3.0

相關用法


注:本文由純淨天空篩選整理自scikit-image.org大神的英文原創作品 skimage.metrics.hausdorff_distance。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。