Advertisement
brandblox

ImgLab-1-(30-10-24)

Oct 30th, 2024
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. import cv2
  2. import numpy as np
  3. import matplotlib.pyplot as plt
  4. img = cv2.imread('peter.jpg')
  5. gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
  6. blurred_image = cv2.GaussianBlur(gray, (5, 5), 1)
  7. canny = cv2.Canny(blurred_image, 50, 100)
  8. plt.figure(figsize=(10,5))
  9. plt.subplot(1,2,1)
  10. plt.imshow(cv2.cvtColor(img,cv2.COLOR_BGR2RGB))
  11. plt.title('Original image')
  12. plt.axis('off')
  13. plt.subplot(1,2,2)
  14. plt.imshow(canny, cmap='gray')
  15. plt.title('Canny image')
  16. plt.axis('off')
  17. plt.show()
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement