Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import imutils
- import cv2
- img = cv2.imread('a.jpg')
- img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
- # threshold image
- ret, threshed_img = cv2.threshold(blurred, 200, 255, cv2.THRESH_BINARY_INV)
- # find contours and get the external one
- #edged = imutils.auto_canny(threshed_img)
- ctrz = cv2.findContours(threshed_img, cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)
- cnts = imutils.grab_contours(ctrz)
- (cnts, boundingBoxes) = contours.sort_contours(cnts, method="left-to-right")
- boundingBoxes = list(boundingBoxes)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement