hud.draw_ball_points(frame, objects) hud.draw_success_counters(frame) # Show frame with boxes drawn capture_out.write(frame) cv2.imshow('frame', frame) # Quit if q is pressed if pressed_key & 0xFF == ord('q'): break if DEBUG_MODE: # Calculate FPS and print it out frame_time = process_time() - frame_start_time frames_per_second = int( 1 / frame_time) if frame_time else 1 # div by 0 check print("FPS = ", frames_per_second) # Clean up cap.release() capture_out.release() cv2.destroyAllWindows() # Write user settings to a file conf.set_settings(settings) # Append use statistics to a file in a Success,Failure format with open('../statistics.csv', 'a') as stat_file: csv_stats = str(hud.get_successes()) + "," + str(hud.get_failures()) + "\n" stat_file.write(csv_stats)