# Display the resulting frame #cv2.imshow('frame', BGR_frame) # Record a video # out.write(frame) if cv2.waitKey(1) & 0xFF == ord('c'): cv2.imwrite("calibration.jpg", BGR_frame) print "Calibrating" fingers = ax.calibrate(BGR_frame, hull, indices, cnt, palmCenter) for finger in fingers: cv2.circle(BGR_frame, finger, 5, [0, 0, 255], 2) img_pts = ax.get_img_pts(fingers, palmCenter) axis = ax.get_axis_2d(img_pts) cv2.line(BGR_frame, axis[3], axis[0], (255, 0, 0), 5) cv2.line(BGR_frame, axis[3], axis[1], (0, 255, 0), 5) cv2.line(BGR_frame, axis[3], axis[2], (0, 0, 255), 5) cv2.imshow('frame', BGR_frame) curr_time = time.time() else: if ax.calibrated: # calibrating again each time actually seems to work better idk #fingers = ax.calibrate(BGR_frame, hull, palmCenter) fingers = ax.find_fingers( BGR_frame, hull, indices, cnt, palmCenter) #ax.calibrate(BGR_frame, hull, palmCenter)