img = cv2.imread(r"C:\Users\admin\Desktop\hb.jpg")
cv2.imshow('img', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
使用的方法是
cv2.erode(img,kernel,iterations=1)
img:原图
kenrnel:核的大小
iterations:迭代次数
img = cv2.imread(r"C:\Users\admin\Desktop\hb.jpg")
kernel = np.ones((3, 3), np.uint8)
erosion = cv2.erode(img,kernel,iterations=1)
cv2.imshow('img', erosion)
cv2.waitKey(0)
cv2.destroyAllWindows()
img = cv2.imread(r"C:\Users\admin\Desktop\hb.jpg")
cv2.imshow('img', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
使用的方法是
cv2.dilate(img,kernel,iterations=1)
img:原图
kenrnel:核的大小
iterations:迭代次数
kernel = np.ones((3, 3), np.uint8)
dilate = cv2.dilate(img,kernel,iterations=1)
cv2.imshow('img', dilate)
cv2.waitKey(0)
cv2.destroyAllWindows()