Python查找图像轮廓
1、打开IDLE。

3、产生一个图像,这里采用手工的方式画出了一张图。img=np.zeros([100,100])img[20:40,60:80]租涫疼迟=1rr,cc=draw.circle(60,60,10)rr1,cc1=draw.circle(20,30,15)img[rr,cc]=1img[rr1,cc1]=1

5、采用下面代码,显示我们的结果。fig, (ax0巳呀屋饔,ax1) = plt.subplots(1,2)ax0.imshow(img,plt.cm.gray)ax1.imshow(img,plt.cm.gray)for n, contour in enumerate(contours): ax1.plot(contour[:, 1], contour[:, 0], linewidth=2)plt.show()

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