Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cap = cv2.VideoCapture(0)
- if circles is not None:
- # convert the (x, y) coordinates and radius of the circles to integers
- circles = np.round(circles[0, :]).astype("int")
- # loop over the (x, y) coordinates and radius of the circles
- for (x, y, r) in circles:
- # draw the circle in the output image, then draw a rectangle in the image
- # corresponding to the center of the circle
- cv2.circle(output, (x, y), r, (0, 255, 0), 4)
- cv2.rectangle(output, (x - 5, y - 5), (x + 5, y + 5), (0, 128, 255), -1)
- time.sleep(1)
- print ("Radius is: ")
- print (r)
- cv2.imshow('gray',gray)
- cv2.imshow('frame',output)
- if cv2.waitKey(1) & 0xFF == ord('q'):
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement