Skip to content

Instantly share code, notes, and snippets.

@lachlanagnew
Created August 10, 2018 01:50
Show Gist options
  • Save lachlanagnew/264e1c3a31141efa374717c03bad5c25 to your computer and use it in GitHub Desktop.
Save lachlanagnew/264e1c3a31141efa374717c03bad5c25 to your computer and use it in GitHub Desktop.
newImage = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
_ , contours, _ = cv2.findContours(res, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
cv2.drawContours(newImage, contours, -1, (255, 255, 0), 1)
for cnt in contours:
M = cv2.moments(cnt)
(x,y),radius = cv2.minEnclosingCircle(cnt)
if(radius > 10):
center = (int(x),int(y))
radius = int(radius)
cv2.circle(newImage,center,radius,(0,255,0),2)
objectFound()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment