def paint_errors(self, img): error_range = (0.0,100.0) output_range = (0.0,30.0) xoffset = 10 cam1error = kc.get_dist_between_2_points(self.ball_coords, self.cam1_estimate) cam2error = kc.get_dist_between_2_points(self.ball_coords, self.cam2_estimate) # cam3error = kc.get_dist_between_2_points(self.ball_coords, self.cam3_estimate) cv.Rectangle(img, (xoffset + int(lerp(cam1error, error_range, output_range)), 165), (xoffset, 175), kc.cam1color, cv.CV_FILLED) cv.Rectangle(img, (xoffset + int(lerp(cam2error, error_range, output_range)), 185), (xoffset, 195), kc.cam2color, cv.CV_FILLED)
tloc = (220, yloc+5) cv.PutText(img, c['text'], tloc, self._font, kc.font_color) if __name__ == '__main__': import random print 'creating an instance of Drawing...' d = Drawing() print 'writing out some circle frames...' seconds = 5 numframes = seconds * kc.fps img = d.get_base_image() # create 5 seconds worth of a circle bouncing around: for i in xrange(numframes): coords = (lerp(i, (0,numframes), (0,kc.img_size[0])), lerp(i, (0,numframes), (0,kc.img_size[1]))) cv.Circle(img, coords, 10 + int(random.gauss(0,2)), cv.RGB(255,100,0), -1) d.paint_cameras(img) d.write_frame(img) seconds = 5 numframes = seconds * kc.fps # create 5 seconds worth of a circle bouncing around: for i in xrange(numframes): coords = (lerp(i, (numframes,0), (0,kc.img_size[0])), lerp(i, (0,numframes), (0,kc.img_size[1]))) cv.Circle(img, coords, 10, cv.RGB(0,100,255), -1) d.paint_cameras(img) d.write_frame(img) print 'all done!'