Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. import cv2
  2.  
  3. def canny(image):
  4. gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
  5. blur = cv2.GaussianBlur(gray, (5,5), 0)
  6. canny = cv2.Canny(blur, 10, 50) ##### TO BE CONFIGURED
  7. return canny
  8.  
  9. imgName = 'low' #low, mid or high
  10. image = cv2.imread(%s.jpg'%imgName)
  11. canny_image = canny(image)
  12. closing_image = cv2.morphologyEx(canny_image, cv2.MORPH_CLOSE, np.ones((4,4), np.uint8))
  13.  
  14. cv2.imshow('result',closing_image)
  15. cv2.waitKey(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement