用法:
skimage.morphology.skeletonize(image, *, method=None)
計算二值圖像的骨架。
細化用於將二進製圖像中的每個連接組件減少為single-pixel 寬骨架。
- skeleton:ndarray
變薄的圖像。
參數:
返回:
參考:
- Lee94
T.-C. Lee, R.L. Kashyap and C.-N. Chu, Building skeleton models via 3-D medial surface/axis thinning algorithms. Computer Vision, Graphics, and Image Processing, 56(6):462-478, 1994.
- Zha84
A fast parallel algorithm for thinning digital patterns, T. Y. Zhang and C. Y. Suen, Communications of the ACM, March 1984, Volume 27, Number 3.
例子:
>>> X, Y = np.ogrid[0:9, 0:9] >>> ellipse = (1./3 * (X - 4)**2 + (Y - 4)**2 < 3**2).astype(np.uint8) >>> ellipse array([[0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0]], dtype=uint8) >>> skel = skeletonize(ellipse) >>> skel.astype(np.uint8) array([[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8)
相關用法
- Python skimage.morphology.h_minima用法及代碼示例
- Python skimage.morphology.dilation用法及代碼示例
- Python skimage.morphology.remove_small_holes用法及代碼示例
- Python skimage.morphology.flood_fill用法及代碼示例
- Python skimage.morphology.black_tophat用法及代碼示例
- Python skimage.morphology.h_maxima用法及代碼示例
- Python skimage.morphology.local_maxima用法及代碼示例
- Python skimage.morphology.area_closing用法及代碼示例
- Python skimage.morphology.label用法及代碼示例
- Python skimage.morphology.max_tree_local_maxima用法及代碼示例
- Python skimage.morphology.thin用法及代碼示例
- Python skimage.morphology.flood用法及代碼示例
- Python skimage.morphology.diameter_closing用法及代碼示例
- Python skimage.morphology.remove_small_objects用法及代碼示例
- Python skimage.morphology.reconstruction用法及代碼示例
- Python skimage.morphology.erosion用法及代碼示例
- Python skimage.morphology.diameter_opening用法及代碼示例
- Python skimage.morphology.max_tree用法及代碼示例
- Python skimage.morphology.local_minima用法及代碼示例
- Python skimage.morphology.medial_axis用法及代碼示例
注:本文由純淨天空篩選整理自scikit-image.org大神的英文原創作品 skimage.morphology.skeletonize。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。