Professional Documents
Culture Documents
Pi19404
April 2, 2013
Contents
Contents
Android OpenCV :Simple Face Tracking
0.1 0.2 0.3 0.4 Introduction . . . . . . . . . . . . . . . . . . . Processing Raw Camera Data and other Face Tracking . . . . . . . . . . . . . . . . . . Face Tracking : Implementation Details 0.4.1 Native Code . . . . . . . . . . . . . . . 0.4.2 Java Code . . . . . . . . . . . . . . . . 0.5 Launch Application . . . . . . . . . . . . . . . 0.6 Code . . . . . . . . . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . . details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3
3 3 3 4 4 6 6 6 6
2 | 7
3 | 7
Android OpenCV :Simple Face Tracking If the tracking is lost at any stage ,localization algorithm is triggered again and cycle of localization and tracking continues.
The haarcascade constructor accepts the haar cascade configuration file name as input and loads the configuration file. The function detect accepts the input frame performs ,resizes the image ,pre processes the image and then performs multiscale detection using haar cascade classifier.
From a list of possible candidates it selects the largest ROI detected and returns the details to main tracking algorithm. To achieve real time performance on the mobile phone the image is reduced to 160x120. The haar detection is performed on this downscaled image and the location of face region are scaled by suitable ammount to plot the ROI properly. The class meanshift provides high level interface to camshift tracking algorithm.
4 | 7
1 2 3 4
meanshift () void buildHistogram () Mat calcProbability () int track ( Mat & image , Rect & rect )
The method meanshift is constructor for the class which initializes the parameters of histogram etc The method buildHistogram is method which constructs the HS histogram from the input frame. The method calcProbability is a method which computes the probability map of frame once histogram has been constructed. The method track is the main method to be called for mean shift tracking .
The class OpenCVProcess is main class which provide interface to the java code.The methods of class are as follows
1 2 3 4
int run ( int width , int height , signed char * _yuv , int * _bgra ) int run ( Mat bgr ) void initDetector ( const char * name ) void initTracker ()
The method is main method face.The primary task is to BGR image and then call the Mat data structure which as
that is called by the java interdecode the camera data to Mat run routine which is the main with input processing routine. the tracker status .If the cascade classifier for face shift tracker and provides classifier as input .
The run(Mat bgr) method checks status is false it calles the haar localization else it calls the mean the ROI detected by haar cascade
the initDetector method calls the initialization routine of haar cascade class to load the configuration file. the initTracke method sets the tracker status to false so that face localization loop is executed.
If errors occur in the opencv native routine it will not be caught by the java interface.Hence a retun code is passed to indicate status of the opencv native routines.
5 | 7
Image
0.6 Code
The code can be found in code repository https://github.com/ pi19404/m19404/tree/master/Android/AndroidOpenCV1.2 or https://code. google.com/p/m19404/source/browse/Android/AndroidOpenCV1.2. The header files is located in jni directory.The library files are not placed in the repository download them from appropriate packages on send a mail separately for download link.
6 | 7
Bibliography
Bibliography
[1] Gary R. Bradski. Computer Vision Face Tracking For Use in a Perceptual User Interface. In: Intel Technology Journal Q2 (1998).
[2]
Paul A. Viola and Michael J. Jones. Rapid Object Detection using a Boosted Cascade of Simple Features. In: CVPR (1). 2001, pp. 511518.
7 | 7