Skip to Content
Learning OpenCV 4 Computer Vision with Python 3 - Third Edition
book

Learning OpenCV 4 Computer Vision with Python 3 - Third Edition

by Joseph Howse, Joe Minichino
February 2020
Intermediate to advanced
372 pages
9h 26m
English
Packt Publishing
Content preview from Learning OpenCV 4 Computer Vision with Python 3 - Third Edition

Running and testing the application

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Building Computer Vision Projects with OpenCV 4 and C++

Building Computer Vision Projects with OpenCV 4 and C++

David Millan Escriva, Prateek Joshi, Vinicius G. Mendonca, Roy Shilkrot

Publisher Resources

ISBN: 9781789531619Supplemental Content