1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| import cv2
img = cv2.imread('cat_img.jpg')
imgCanny = cv2.Canny(img,100,100)
kernel = np.ones((5,5), np.uint8)
imgDialation = cv2.dilate(imgCanny, kernel=kernel,iterations=1)
imgEroded = cv2.erode(imgDialation, kernel=kernel, iterations=1)
cv2.imshow('output3',imgCanny) cv2.imshow('output4',imgDialation) cv2.imshow('output5',imgEroded)
cv2.waitKey(0)
|