Skip to content

Instantly share code, notes, and snippets.

@prateekjoshi565
Created April 20, 2020 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prateekjoshi565/9cf7d3c020be01e3dc71c84f83cad1b8 to your computer and use it in GitHub Desktop.
Save prateekjoshi565/9cf7d3c020be01e3dc71c84f83cad1b8 to your computer and use it in GitHub Desktop.
valid_cntrs = []
for i,cntr in enumerate(contours):
x,y,w,h = cv2.boundingRect(cntr)
if (x <= 200) & (y >= 80) & (cv2.contourArea(cntr) >= 25):
valid_cntrs.append(cntr)
# count of discovered contours
len(valid_cntrs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment