Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- image = cv2.imread("somefile.png")
- gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
- gray = cv2.GaussianBlur(gray, (7, 7), 0)
- edged = cv2.Canny(gray, 20, 50)
- edged = cv2.dilate(edged, None, iterations=1)
- edged = cv2.erode(edged, None, iterations=1)
- cnts = cv2.findContours(edged.copy(), cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)
- cnts = imutils.grab_contours(cnts)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement