Book Image

Mastering OpenCV Android Application Programming

Book Image

Mastering OpenCV Android Application Programming

Overview of this book

Table of Contents (16 chapters)
Mastering OpenCV Android Application Programming
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
6
Working with Image Alignment and Stitching
Index

Face detection using the cascade classifier


One of the most common applications of the cascade classifier is face detection. Implementation for both Haar and LBP classifiers on Android using OpenCV is very similar; the only difference is in the model that we use to detect faces. Let's work on a generic application for face detection and make relevant changes to the application to accommodate both Haar and LBP cascades. The application will display the camera preview on the entire screen (landscape orientation) and make rectangles around faces in each frame. It will also provide an option to switch between the front and back camera. Following are the steps to create this application:

  1. Create a new Eclipse (or Android Studio) project with a blank activity and call the application Face Detection. It will be a landscape application with a fullscreen camera preview.

  2. In the application tag, add the following line to make a fullscreen application:

    android:theme="@android:style/Theme.NoTitleBar.Fullscreen...