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


Python skimage.transform.hough_ellipse用法及代碼示例

用法:

skimage.transform.hough_ellipse(image, threshold=4, accuracy=1, min_size=4, max_size=None)

執行橢圓霍夫變換。

參數

image(M, N) ndarray

具有表示邊的非零值的輸入圖像。

thresholdint 可選

累加器閾值。

accuracy雙,可選

累加器中使用的短軸上的 bin 大小。

min_sizeint 可選

最小長軸長度。

max_sizeint 可選

最大短軸長度。如果為 None,則該值設置為較小圖像尺寸的一半。

返回

result具有字段 [(accumulator, yc, xc, a, b,orientation)] 的 ndarray。

在哪裏(yc, xc)是中心,(a, b)分別是長軸和短軸。這方向值跟隨skimage.draw.ellipse_perimeter慣例。

注意

必須選擇精度以在累加器分布中產生峰值。換句話說,具有低值的平坦累加器分布可能是由太低的 bin 大小引起的。

參考

1

Xie, Yonghong, and Qiang Ji. “A new efficient ellipse detection method.” Pattern Recognition, 2002. Proceedings. 16th International Conference on. Vol. 2. IEEE, 2002

例子

>>> from skimage.transform import hough_ellipse
>>> from skimage.draw import ellipse_perimeter
>>> img = np.zeros((25, 25), dtype=np.uint8)
>>> rr, cc = ellipse_perimeter(10, 10, 6, 8)
>>> img[cc, rr] = 1
>>> result = hough_ellipse(img, threshold=8)
>>> result.tolist()
[(10, 10.0, 10.0, 8.0, 6.0, 0.0)]

相關用法


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