用法:
skimage.morphology.diameter_opening(image, diameter_threshold=8, connectivity=1, parent=None, tree_traverser=None)
執行圖像的直徑開口。
直徑開口會移除最大擴展小於diameter_threshold 的圖像的所有明亮結構。最大擴展定義為邊界框的最大擴展。該運算符也稱為邊界框打開。在實踐中,結果類似於形態開口,但不會去除細長結構。
從技術上講,此運算符基於圖像的max-tree 表示。
- image:ndarray
要計算area_opening 的輸入圖像。此圖像可以是任何類型。
- diameter_threshold:無符號int
最大擴展參數(像素數)。默認值為 8。
- connectivity:無符號 int 可選
鄰裏連通性。整數表示到達鄰居的最大正交步數。在 2D 中,4 鄰域為 1,8 鄰域為 2。默認值為 1。
- parent:ndarray,int64,可選
表示圖像的最大樹的父圖像。每個像素的值是其父級在 raveled 數組中的索引。
- tree_traverser:一維數組,int64,可選
有序像素索引(指的是散列數組)。像素被排序,使得每個像素都位於其父級之前(除了沒有父級的根)。
- output:ndarray
與輸入圖像具有相同形狀和類型的輸出圖像。
參數:
返回:
參考:
- 1
Walter, T., & Klein, J.-C. (2002). Automatic Detection of Microaneurysms in Color Fundus Images of the Human Retina by Means of the Bounding Box Closing. In A. Colosimo, P. Sirabella, A. Giuliani (Eds.), Medical Data Analysis. Lecture Notes in Computer Science, vol 2526, pp. 210-220. Springer Berlin Heidelberg. DOI:10.1007/3-540-36104-9_23
- 2
Carlinet, E., & Geraud, T. (2014). A Comparative Review of Component Tree Computation Algorithms. IEEE Transactions on Image Processing, 23(9), 3885-3895. DOI:10.1109/TIP.2014.2336551
例子:
我們創建一個圖像(中心最大值和 4 個附加局部最大值的二次函數。
>>> w = 12 >>> x, y = np.mgrid[0:w,0:w] >>> f = 20 - 0.2*((x - w/2)**2 + (y-w/2)**2) >>> f[2:3,1:5] = 40; f[2:4,9:11] = 60; f[9:11,2:4] = 80 >>> f[9:10,9:11] = 100; f[10,10] = 100 >>> f = f.astype(int)
我們可以計算直徑開口:
>>> open = diameter_opening(f, 3, connectivity=1)
去除最大延伸為 2 或更少的峰。其餘峰的最大延伸都至少為 3。
相關用法
- Python skimage.morphology.diameter_closing用法及代碼示例
- Python skimage.morphology.dilation用法及代碼示例
- Python skimage.morphology.h_minima用法及代碼示例
- 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.remove_small_objects用法及代碼示例
- Python skimage.morphology.reconstruction用法及代碼示例
- Python skimage.morphology.erosion用法及代碼示例
- Python skimage.morphology.max_tree用法及代碼示例
- Python skimage.morphology.local_minima用法及代碼示例
- Python skimage.morphology.medial_axis用法及代碼示例
- Python skimage.morphology.skeletonize用法及代碼示例
注:本文由純淨天空篩選整理自scikit-image.org大神的英文原創作品 skimage.morphology.diameter_opening。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。