sleep(1) print("Starting") try: # Start recording frames to the stream object camera.start_recording(stream, format='yuv') t0 = time() while True: camera.wait_recording(1) # If the time limit is reached, end the recording if (time() - t0) > MAX_TIME: camera.stop_recording() break except Exception as e: print(e) camera.close() # Print Timing Information stream.print_statistics(MAX_TIME) # Save camera frames with detections overlaid stream.save_video(MAX_TIME) # Save position numpy arrays stream.save_positions() # Create scatter plot of estimated positions stream.scatter_position() # Animate the stream to show the camera moving in real time # stream.animate_position(MAX_TIME) set_trace() camera.close()