def cv_show(name,img):
cv2.imshow(name,img)
cv2.waitKey(0)
cv2.destroyAllWindows()
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
img=cv2.imread("lena.jpg",cv2.IMREAD_GRAYSCALE)
v1=cv2.Canny(img,80,150)
v2=cv2.Canny(img,50,100)
res = np.hstack((v1,v2))
cv_show(“res”,res)
plt.imshow(res)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
<matplotlib.image.AxesImage at 0x1e2434759e8>
- 1
img=cv2.imread("car.png",cv2.IMREAD_GRAYSCALE)
v1=cv2.Canny(img,120,250)
v2=cv2.Canny(img,50,100)
res = np.hstack((v1,v2))
cv_show(“res”,res)
plt.imshow(res)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
<matplotlib.image.AxesImage at 0x1e254ca7828>
- 1
</div>
<link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-e9f16cbbc2.css" rel="stylesheet">
</div>