To complete the implementation of ImageTrackingDemo.py, let's write a main function that launches the application with a specified capture device, FOV, and target frame rate:
def main(): capture = cv2.VideoCapture(0) capture.set(cv2.CAP_PROP_FRAME_WIDTH, 1280) capture.set(cv2.CAP_PROP_FRAME_HEIGHT, 720) diagonal_fov_degrees = 70.0 target_fps = 25.0 demo = ImageTrackingDemo( capture, diagonal_fov_degrees, target_fps) demo.run()if __name__ == '__main__': main()
Here, we are using a capture resolution of 1280 x 720, a diagonal FOV of 70 degrees, and a target frame rate of 25 FPS. You should choose parameters that are appropriate for your camera and lens, and for the speed of your system.
Let's suppose we run ...