Book Image

OpenCV with Python Blueprints

By : Michael Beyeler, Michael Beyeler (USD)
Book Image

OpenCV with Python Blueprints

By: Michael Beyeler, Michael Beyeler (USD)

Overview of this book

Table of Contents (14 chapters)
OpenCV with Python Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Putting it all together


The result of our app can be seen in the following image:

Throughout the video sequence, the algorithm is able to pick up the location of the players, successfully tracking them frame-by-frame by using mean-shift tracking, and combining the resulting bounding boxes with the bounding boxes returned by the salience detector.

It is only through the clever combination of the saliency map and tracking that we can exclude false-positives such as line markings and artifacts of the saliency map. The magic happens in cv2.groupRectangles, which requires a similar bounding box to appear at least twice in the box_all list, otherwise it is discarded. This means that a bounding box is only then kept in the list if both mean-shift tracking and the saliency map (roughly) agree on the location and size of the bounding box.