用法:
skimage.filters.prewitt(image, mask=None, *, axis=None, mode='reflect', cval=0.0)
使用 Prewitt 變換查找邊幅度。
- image:數組
輸入圖像。
- mask:布爾數組,可選
將輸出圖像剪輯到此蒙版。 (mask=0 的值將被設置為 0。)
- axis:int 或 int 序列可選
沿該軸計算邊濾波器。如果未提供,則計算邊幅度。這被定義為:
prw_mag = np.sqrt(sum([prewitt(image, axis=i)**2 for i in range(image.ndim)]) / image.ndim)
如果軸是一個序列,也會計算幅度。
- mode:str 或 str 序列,可選
卷積的邊界模式。有關模式的說明,請參見
scipy.ndimage.convolve
- cval:浮點數,可選
什麽時候模式是
'constant'
,這是在圖像數據邊界之外的值中使用的常數。
- output:浮點數數組
Prewitt 邊圖。
參數:
返回:
注意:
邊幅度略微取決於邊方向,因為 Prewitt 算子對梯度算子的近似不是完全旋轉不變的。為了獲得更好的旋轉不變性,應使用 Scharr 算子。 Sobel 算子比 Prewitt 算子具有更好的旋轉不變性,但比 Scharr 算子具有更差的旋轉不變性。
例子:
>>> from skimage import data >>> from skimage import filters >>> camera = data.camera() >>> edges = filters.prewitt(camera)
相關用法
- Python skimage.filters.unsharp_mask用法及代碼示例
- Python skimage.filters.rank.noise_filter用法及代碼示例
- Python skimage.filters.gaussian用法及代碼示例
- Python skimage.filters.threshold_otsu用法及代碼示例
- Python skimage.filters.rank.sum用法及代碼示例
- Python skimage.filters.window用法及代碼示例
- Python skimage.filters.gabor用法及代碼示例
- Python skimage.filters.rank.autolevel用法及代碼示例
- Python skimage.filters.threshold_li用法及代碼示例
- Python skimage.filters.rank.pop用法及代碼示例
- Python skimage.filters.rank.mean用法及代碼示例
- Python skimage.filters.rank.pop_bilateral用法及代碼示例
- Python skimage.filters.rank.maximum用法及代碼示例
- Python skimage.filters.roberts用法及代碼示例
- Python skimage.filters.rank.equalize用法及代碼示例
- Python skimage.filters.rank.enhance_contrast用法及代碼示例
- Python skimage.filters.rank.gradient用法及代碼示例
- Python skimage.filters.LPIFilter2D.__init__用法及代碼示例
- Python skimage.filters.farid用法及代碼示例
- Python skimage.filters.rank_order用法及代碼示例
注:本文由純淨天空篩選整理自scikit-image.org大神的英文原創作品 skimage.filters.prewitt。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。