Mastering OpenCV 3 - Second Edition
- 250 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Mastering OpenCV 3 - Second Edition
About This Book
Practical Computer Vision ProjectsAbout This Bookā¢ Updated for OpenCV 3, this book covers new features that will help you unlock the full potential of OpenCV 3ā¢ Written by a team of 7 experts, each chapter explores a new aspect of OpenCV to help you make amazing computer-vision aware applicationsā¢ Project-based approach with each chapter being a complete tutorial, showing you how to apply OpenCV to solve complete problemsWho This Book Is ForThis book is for those who have a basic knowledge of OpenCV and are competent C++ programmers. You need to have an understanding of some of the more theoretical/mathematical concepts, as we move quite quickly throughout the book.What You Will Learnā¢ Execute basic image processing operations and cartoonify an imageā¢ Build an OpenCV project natively with Raspberry Pi and cross-compile it for Raspberry Pi.textā¢ Extend the natural feature tracking algorithm to support the tracking of multiple image targets on a videoā¢ Use OpenCV 3's new 3D visualization framework to illustrate the 3D scene geometryā¢ Create an application for Automatic Number Plate Recognition (ANPR) using a support vector machine and Artificial Neural Networksā¢ Train and predict pattern-recognition algorithms to decide whether an image is a number plateā¢ Use POSIT for the six degrees of freedom head poseā¢ Train a face recognition database using deep learning and recognize faces from that databaseIn DetailAs we become more capable of handling data in every kind, we are becoming more reliant on visual input and what we can do with those self-driving cars, face recognition, and even augmented reality applications and games. This is all powered by Computer Vision.This book will put you straight to work in creating powerful and unique computer vision applications. Each chapter is structured around a central project and deep dives into an important aspect of OpenCV such as facial recognition, image target tracking, making augmented reality applications, the 3D visualization framework, and machine learning. You'll learn how to make AI that can remember and use neural networks to help your applications learn.By the end of the book, you will have created various working prototypes with the projects in the book and will be well versed with the new features of OpenCV3.Style and approachThis book takes a project-based approach and helps you learn about the new features by putting them to work by implementing them in your own projects.
Frequently asked questions
Information
Face Recognition Using Eigenfaces or Fisherfaces
- Face detection
- Face preprocessing
- Training a machine-learning algorithm from collected faces
- Face recognition
- Finishing touches
Introduction to face recognition and face detection
- Face detection: This is the process of locating a face region in an image (a large rectangle near the center of the following screenshot). This step does not care who the person is, just that it is a human face.
- Face preprocessing: This is the process of adjusting the face image to look more clear and similar to other faces (a small grayscale face in the top-center of the following screenshot).
- Collecting and learning faces: This is the process of saving many preprocessed faces (for each person that should be recognized), and then learning how to recognize them.
- Face recognition: This is the process that checks which of the collected people are most similar to the face in the camera (a small rectangle on the top-right of the following screenshot).
Step 1 - face detection
Implementing face detection using OpenCV
Type of cascade classifier | XML filename |
Face detector (default) | haarcascade_frontalface_default.xml |
Face detector (fast Haar) | haarcascade_frontalface_alt2.xml |
Face detector (fast LBP) | lbpcascade_frontalface.xml |
Profile (side-looking) face detector | haarcascade_profileface.xml |
Eye detector (separate for left and right) | haarcascade_lefteye_2splits.xml |
Mouth detector | haarcascade_mcs_mouth.xml |
Nose detector | haarcascade_mcs_nose.xml |
Whole person detector | haarcascade_fullbody.xml |
Loading a Haar or LBP detector for object or face detection
CascadeClassifier faceDetector; faceDetector.load(faceCascadeFilename);
CascadeClassifier faceDetector; try { faceDetector.load(faceCascadeFilename); } catch (cv::Exception e) {} if ( faceDetector.empty() ) { cerr << "ERROR: Couldn't load Face Detector ("; cerr << faceCascadeFilename << ")!" << endl; exit(1); }
Accessing the webcam
Detecting an object using the Haar or LBP Classifier
- Grayscale color conversion: Face detection only works on grayscale images. So we should convert the color camera frame to grayscale.
- Shrinking the camera image: The speed of face detection depends on the size of the input image (it is very slow for large images but fast for small images), and yet detection is still fairly reliable even at low resolutions. So we should shrink the camera image to a more reasonable size (or use a large value for minFeatureSize in the detector, as explained shortly).
- Histogram equalization: Face detection is not as reliable in low-light conditions. So we should perform histogram equalization to improve the contrast and brightness.
Grayscale color conversion
Table of contents
- Title Page
- Copyright
- Credits
- About the Authors
- About the Reviewer
- www.PacktPub.com
- Customer Feedback
- Preface
- Cartoonifier and Skin Changer for Raspberry Pi
- Exploring Structure from Motion Using OpenCV
- Number Plate Recognition using SVM and Neural Network
- Non-Rigid Face Tracking
- 3D Head Pose Estimation Using AAM and POSIT
- Face Recognition Using Eigenfaces or Fisherfaces