Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. cap = cv2.VideoCapture(0)
  2.  
  3. if circles is not None:
  4. # convert the (x, y) coordinates and radius of the circles to integers
  5. circles = np.round(circles[0, :]).astype("int")
  6.  
  7. # loop over the (x, y) coordinates and radius of the circles
  8. for (x, y, r) in circles:
  9. # draw the circle in the output image, then draw a rectangle in the image
  10. # corresponding to the center of the circle
  11. cv2.circle(output, (x, y), r, (0, 255, 0), 4)
  12. cv2.rectangle(output, (x - 5, y - 5), (x + 5, y + 5), (0, 128, 255), -1)
  13. time.sleep(1)
  14. print ("Radius is: ")
  15. print (r)
  16.  
  17.  
  18. cv2.imshow('gray',gray)
  19. cv2.imshow('frame',output)
  20.  
  21. if cv2.waitKey(1) & 0xFF == ord('q'):
  22. break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement