注意
转到末尾 下载完整的示例代码。
3.3.11.5. 使用 Sobel 滤波器计算水平梯度¶
此示例说明了如何使用水平 Sobel 滤波器计算水平梯度。

from skimage import data
from skimage import filters
import matplotlib.pyplot as plt
text = data.text()
hsobel_text = filters.sobel_h(text)
plt.figure(figsize=(12, 3))
plt.subplot(121)
plt.imshow(text, cmap="gray", interpolation="nearest")
plt.axis("off")
plt.subplot(122)
plt.imshow(hsobel_text, cmap="nipy_spectral", interpolation="nearest")
plt.axis("off")
plt.tight_layout()
plt.show()
脚本总运行时间:(0 分钟 0.099 秒)