Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- img = cv2.resize(img, (0,0), fx=2, fy=2)
- gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
- ret, thresh = cv2.threshold(gray_img, 127, 255, 1)
- _, contours , _= cv2.findContours(thresh, cv2.RETR_TREE, 1)
- cnt = contours
- for i in range(len(contours)):
- #---- Mark contours above certain area ----
- if (cv2.contourArea(cnt[i]) > 1500):
- final_image = cv2.drawContours(img, cnt[i], -1, (0,255,0), 3)
- cv2.imshow('Marked image', final_image )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement