Python如何对图像二值化(li算法)
1、打开IDLE,即Python shell界面;
载入相蹲没关的库文件:
from skimage import data,color,filters
import matplotlib.pyplot as plt

2、读季政取一个图片,这里读取包内的图片文件,并将其牢态兼灰度化处理:
image=color.rgb2gray(data.camera())

3、对图片进行li算法运算,采用以下代码:
thresh = filters.threshold_li(image)
dst =(image <= thresh)*1.0

4、采用下面的代码查看,二值化以后的图片:
plt.imshow(dst,plt.cm.gray)
plt.show()

5、查看我们的图片效果如下。

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:188
阅读量:60
阅读量:160
阅读量:171
阅读量:182