本文簡要介紹 python 語言中 scipy.ndimage.laplace
的用法。
用法:
scipy.ndimage.laplace(input, output=None, mode='reflect', cval=0.0)#
N-D 基於近似二階導數的拉普拉斯濾波器。
- input: array_like
輸入數組。
- output: 數組或數據類型,可選
放置輸出的數組,或返回數組的 dtype。默認情況下,將創建一個與輸入具有相同 dtype 的數組。
- mode: str 或序列,可選
mode 參數確定當過濾器與邊框重疊時如何擴展輸入數組。通過傳遞長度等於輸入數組維數的模式序列,可以沿每個軸指定不同的模式。默認值為‘reflect’。有效值及其行為如下:
- ‘reflect’ (d c b a | a b c d | d c b a)
通過反射最後一個像素的邊來擴展輸入。此模式有時也稱為half-sample 對稱模式。
- ‘constant’ (k k k k | a b c d |呸呸呸呸)
通過使用 cval 參數定義的相同常量值填充邊之外的所有值來擴展輸入。
- ‘nearest’ (啊啊啊啊| a b c d |嘀嘀嘀嘀)
通過複製最後一個像素來擴展輸入。
- ‘mirror’ (d c b | a b c d | c b a)
通過反射最後一個像素的中心來擴展輸入。此模式有時也稱為whole-sample 對稱模式。
- ‘wrap’ (a b c d | a b c d | A B C D)
通過環繞到相對邊來擴展輸入。
為了與插值函數保持一致,還可以使用以下模式名稱:
- ‘grid-constant’
這是‘constant’ 的同義詞。
- ‘grid-mirror’
這是‘reflect’ 的同義詞。
- ‘grid-wrap’
這是‘wrap’ 的同義詞。
- cval: 標量,可選
如果模式為‘constant’,則填充過去輸入邊的值。默認值為 0.0。
- laplace: ndarray
過濾數組。具有與輸入相同的形狀。
參數 ::
返回 ::
例子:
>>> from scipy import ndimage, datasets >>> import matplotlib.pyplot as plt >>> fig = plt.figure() >>> plt.gray() # show the filtered result in grayscale >>> ax1 = fig.add_subplot(121) # left side >>> ax2 = fig.add_subplot(122) # right side >>> ascent = datasets.ascent() >>> result = ndimage.laplace(ascent) >>> ax1.imshow(ascent) >>> ax2.imshow(result) >>> plt.show()
相關用法
- Python SciPy ndimage.label用法及代碼示例
- Python SciPy ndimage.labeled_comprehension用法及代碼示例
- Python SciPy ndimage.correlate用法及代碼示例
- Python SciPy ndimage.morphological_gradient用法及代碼示例
- Python SciPy ndimage.variance用法及代碼示例
- Python SciPy ndimage.correlate1d用法及代碼示例
- Python SciPy ndimage.binary_dilation用法及代碼示例
- Python SciPy ndimage.distance_transform_bf用法及代碼示例
- Python SciPy ndimage.find_objects用法及代碼示例
- Python SciPy ndimage.maximum_filter1d用法及代碼示例
- Python SciPy ndimage.iterate_structure用法及代碼示例
- Python SciPy ndimage.map_coordinates()用法及代碼示例
- Python SciPy ndimage.generic_laplace用法及代碼示例
- Python SciPy ndimage.generate_binary_structure用法及代碼示例
- Python SciPy ndimage.binary_opening用法及代碼示例
- Python SciPy ndimage.binary_fill_holes用法及代碼示例
- Python SciPy ndimage.maximum_filter用法及代碼示例
- Python SciPy ndimage.minimum_position用法及代碼示例
- Python SciPy ndimage.grey_erosion用法及代碼示例
- Python SciPy ndimage.spline_filter用法及代碼示例
- Python SciPy ndimage.shift用法及代碼示例
- Python SciPy ndimage.distance_transform_cdt用法及代碼示例
- Python SciPy ndimage.minimum用法及代碼示例
- Python SciPy ndimage.fourier_uniform用法及代碼示例
- Python SciPy ndimage.gaussian_laplace用法及代碼示例
注:本文由純淨天空篩選整理自scipy.org大神的英文原創作品 scipy.ndimage.laplace。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。