Python对图片垂直方向边缘检测(scharr算子)

时间:2026-02-13 21:37:11

1、需要winPython中包含有skimage和matplotlib库;

打开Python shell 也就IDLE

载入五霸级相关的工具箱:

from skimage import io,data,filters,color

import matplotlib.pyplot as plt

Python对图片垂直方向边缘检测(scharr算子)

2、读入我们的图片,并将其海暗灰度化处理:

img=color.rgb2gray(data.coffee())

Python对图片垂直方向边缘检测(scharr算子)

3、采用下面指令获得垂牺驼直的纹理:

edge=filters.scharr_v(img)

Python对图片垂直方向边缘检测(scharr算子)

4、查看我们的结果图片:

plt.imshow(edge,plt.cm.gray)

plt.show()

Python对图片垂直方向边缘检测(scharr算子)

5、我们的结果如下图。

Python对图片垂直方向边缘检测(scharr算子)

© 2026 一点资料
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com