Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
White Ball Tracker
from SimpleCV import *
import time
points = []
cam = Camera(0)
display = Display()
while display.isNotDone():
img = cam.getImage().flipHorizontal()
white_ball = img.colorDistance(Color.WHITE)
only_white = img - white_ball
blobs = only_white.findBlobs()
if blobs:
for b in blobs:
if b.isCircle(0.2):
loc = (b.x,b.y)
img.drawCircle(loc,b.radius(),Color.RED,2)
points.append(loc)
img.drawPoints(points,Color.BLUE,2,-1)
img.show()
time.sleep(0.001)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.