Book Image

OpenCV Computer Vision with Python

By : Joseph Howse
Book Image

OpenCV Computer Vision with Python

By: Joseph Howse

Overview of this book

<p>OpenCV Computer Vision with Python shows you how to use the Python bindings for OpenCV. By following clear and concise examples, you will develop a computer vision application that tracks faces in live video and applies special effects to them. If you have always wanted to learn which version of these bindings to use, how to integrate with cross-platform Kinect drivers, and how to efficiently process image data with NumPy and SciPy, then this book is for you.</p> <p>This book has practical, project-based tutorials for Python developers and hobbyists who want to get started with computer vision with OpenCV and Python. It is a hands-on guide that covers the fundamental tasks of computer vision, capturing, filtering, and analyzing images, with step-by-step instructions for writing both an application and reusable library classes.</p>
Table of Contents (14 chapters)
OpenCV Computer Vision with Python
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Testing and improving <cascade>


<cascade> is an XML file that is compatible with the constructor for OpenCV's CascadeClassifier class. For an example of how to use CascadeClassifier, refer back to our implementation of FaceTracker in Chapter 4, Tracking Faces with Haar Cascades. By copying and modifying FaceTracker and Cameo, you should be able to create a simple test application that draws rectangles around tracked instances of your custom target.

Perhaps in your first attempts at cascade training, you will not get reliable tracking results. To improve your training results, do the following:

  • Consider making your classification problem more specific. For example, a bald, shaven, male face without glasses cascade might be easier to train than a general face cascade. Later, as your results improve, you can try to expand your problem again.

  • Gather more training images, many more!

  • Ensure that <negative_description> contains all the negative training images and only the negative training images.

  • Ensure that <positive_description> contains all the positive training images and only the positive training images.

  • Ensure that the sub-rectangles specified in <positive_description> are accurate.

  • Review and experiment with the optional flags to <opencv_createsamples> and <opencv_traincascade>. The flags are described in the official documentation at http://docs.opencv.org/doc/user_guide/ug_traincascade.html.

Good luck and good image-hunting!