Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cv2
- import numpy as np
- import matplotlib.pyplot as plt
- img = cv2.imread('peter.jpg')
- gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
- blurred_image = cv2.GaussianBlur(gray, (5, 5), 1)
- canny = cv2.Canny(blurred_image, 50, 100)
- plt.figure(figsize=(10,5))
- plt.subplot(1,2,1)
- plt.imshow(cv2.cvtColor(img,cv2.COLOR_BGR2RGB))
- plt.title('Original image')
- plt.axis('off')
- plt.subplot(1,2,2)
- plt.imshow(canny, cmap='gray')
- plt.title('Canny image')
- plt.axis('off')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement