Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. image = cv2.imread("somefile.png")
  2. gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
  3. gray = cv2.GaussianBlur(gray, (7, 7), 0)
  4.  
  5. edged = cv2.Canny(gray, 20, 50)
  6. edged = cv2.dilate(edged, None, iterations=1)
  7. edged = cv2.erode(edged, None, iterations=1)
  8.  
  9. cnts = cv2.findContours(edged.copy(), cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)
  10. cnts = imutils.grab_contours(cnts)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement