Opencv Python版学习笔记08.腐蚀操作

img = cv2.imread('dige.png')

cv2.imshow('img', img)
cv2.waitKey(0)
cv2.destroyAllWindows()

Opencv Python版学习笔记08.腐蚀操作_第1张图片

kernel = np.ones((3,3),np.uint8) 
erosion = cv2.erode(img,kernel,iterations = 1)

cv2.imshow('erosion', erosion)
cv2.waitKey(0)
cv2.destroyAllWindows()

 

Opencv Python版学习笔记08.腐蚀操作_第2张图片

pie = cv2.imread('pie.png')

cv2.imshow('pie', pie)
cv2.waitKey(0)
cv2.destroyAllWindows()

Opencv Python版学习笔记08.腐蚀操作_第3张图片 

kernel = np.ones((30,30),np.uint8) 
erosion_1 = cv2.erode(pie,kernel,iterations = 1)
erosion_2 = cv2.erode(pie,kernel,iterations = 2)
erosion_3 = cv2.erode(pie,kernel,iterations = 3)
res = np.hstack((erosion_1,erosion_2,erosion_3))
cv2.imshow('res', res)
cv2.waitKey(0)
cv2.destroyAllWindows()

 Opencv Python版学习笔记08.腐蚀操作_第4张图片

 

你可能感兴趣的:(Opencv Python版学习笔记08.腐蚀操作)