PURPLE = (128, 0, 128) print "Connecting to GPIO daemon" pi=pigpio.pi() print "Successfully connected" frameSize = (320, 240) xOffset = 50#int(frameSize[0] / 10) yOffset = int(frameSize[1] / 10) numBallLocations = 4 # the number of ball locations we will keep track of numIntersectLocations = 3 # the number of ball-backboard intersection points we will keep track of ballXLRU = LRU(numBallLocations) ballYLRU = LRU(numBallLocations) intLRU = LRU(numIntersectLocations) for i in range(numBallLocations): ballXLRU.push(xOffset) ballYLRU.push(int(frameSize[1] / 2)) for i in range(numIntersectLocations): intLRU.push(frameSize[1] / 2); print "Setting up camera" camera = PiCamera() camera.resolution = frameSize camera.framerate = 24 rawCapture = PiRGBArray(camera, size=frameSize) # allow the camera to warmup time.sleep(0.1) print "Beginning video capture" for frame in camera.capture_continuous(rawCapture, format="bgr", use_video_port=True): frameNum = frameNum + 1