Computer Vision Final Project

: Viola-Jones & Morphology-based Face Detector      

 

Kihwan Kim

Computer Vision CS7495

Final Report link

0. Download the result files

AVI files

Real time detecion of Viola Jones detector

(using webcam) 1.42 Mbyte

V-jcam.avi

Real time detecion of Morphology detector

(using webcam) 1.32 Mbyte

morcam.avi

Real time detecion of Morphology+VJ

(using webcam) 656 Kbyte

v-j-mor.avi

Face detecion in image of VJ and Morp

1.92 Mbyte

vj-mor_img.avi

Training procedure of testing each Feauture type in VJ  1.2 Mbyte

ft_type_test.avi

Training procedure of ADABOOST in single cascade node  1.42 Mbyte

adaboost.avi

Papers

"Rapid Object Detection using a Boosted Cascade of Simple Features" Viola and Jones(CVPR2001)

"Fast Face Detection via Morphology-based Pre-processing" Han and Liao(PR2000)

Executable files

 Executable Face Detection application (see the Readme file first)

Powerpoint & Final Report

Power point files

Final Report and Source Description (CS7495 Computer Vision Final Project.pdf)

 

 

1. Overview

 

For CS7495 final project, I chose two face detection algorithms. First one is based on "Rapid Object Detection using a Boosted Cascade of Simple Features" Viola and Jones(2001) and "Fast Face Detection via Morphology-based Preprocessing"Han and Liao(2000). First one is using cascaded strong classifier which boosted from Adaboost and second one is using labeled feature set from morphological operator and knowledge-based geometric informations. However, at this moment, though I made overall morphology based detector during the semester, I didn't complete overall process of V-J detector. What I've done in V-J is made an Adaboost( single node cascade ) but I didn't complete cascade node for every adaboost. Even though I could complete the every cascading step, the training time is unimaginable.(At last I realized this).  The results of the V-J detector shown in below is using previously trained data set (xml), supported  by Intel (OpenCV). and related api. In summary, I made every step of Morphology detector and part of V-J detector and overall interfaces and application by Visual C++ and OpenCV libarary.

 

2-1. Viola Jones Object detection

 

-AdaBoost

Given a training set containing tagged examples of faces(positive examples) and non-faces(negative examples), we can construct a strong classifier of data vector x from a linear combination of weak classifiers. We can call this method "Boosting"(Combine a number of simple classifiers so that the ensemble is arbitrarily accurate).

Adaboost which mainly used in viola-jones's paper is as follows( More specific information - refer the report attatched above)

 

Description of Adaboost

Image above shows how Adaboost works and How the set of weak classifier can be strong classifier H(x)

 

-Feature Set( Rectangle features)

Using simple rectangular templates such as shows in the below image, we can calculate intensity ratios for sub-windows within the image. For examles. the feature on a is white area - black area. likewise, feature value in c is subtraction of sum of image intensity in black are from sum of intensity in the white-center area.

 

 

 

-Integral Image ( same as 'Summed Area Tables' in Graphics )

 

r templat     Because we calculated too many of features in training( even in 24 by 24 the possible feature set is more than 250,000), we should using some fast algorithm to calculate value of features. To do this we will use the Integral Images which is used in texture mapping in Graphics as a different name - Summed area tabling.  The integral image at location x,y contains the sum of the pixels above and to the left of x,y. where ii(x,y) is the integral image and i(x,y) is the original image. Using the following pair of recurrences.(where, s(x,y) is cumulative row sum, s(x-1)=0 and ii(-1,y) =0. )

 

 

2-2. Morphology-based fast face detection

Applying morphological closing and clipped different operations to find the candidate eye-analogue pixels.

Let X be the original image and superscripts in X means scaling factor. A horizontal structuring element Sh with size 1 by 7 and vertical structuring element Sv with size 7 by 1 are, respectively, operated on X and X(1/2). So using the operation describe followings, the eye-analogue pixels in an image can be located. Where the superscript,2, of E2 and E4 are used to enlarge them to twice the original size. T1,T2,T3 and T4 are four threshold functions whose values are the average values of the images E1,E2,E3 and E4 respectively.

 

 

 

 X After some preprocessing including noise removal , additive histogram equalization .etc, Morphological operator is applied. Then every features shown in below is labled and caculate on the basis of some geometry information of face. So the most reliable candidates and their area selected from tons of candidates.

Images mostly from Han's Fast Face Detection via Morphology-based Pre-processing

 

3. Results & Discussion

Detection results from Images

Input Image

Viola-Jones Detector

Morphology-based Detector

 

 

 

Example above shows the weakness of morphology-based approach which described in report.

 

Furthermore, I manually tried 50 cropped faces images and 50 flipped images for 100 positive examples and 100 randomly chosen negative non-face images. The comparison of two detector is like below( I made a decision after see the result).

 

 

V-J itself is very robust detector if trained very well. Moreover in this test, I used the trained data from OpenCV. So, the result of V-J detector is very wonderful. Six vote on the false positive of the V-J is due to it¡¯s characteristic ¡°multi-detector¡±. In this case it detect one face and one more candidate from background. Morphology-based approach is independent of training set. Because it detect by itself using it¡¯s own process. Moreover, because it¡¯s ( exactly my version ) face verification step is somewhat coarse, it¡¯s false positive is relatively high. And in some case like test example¡¯s face has asymmetric shade, Morphology-based detector found some other candidate belongs to non-face set.

 

Multi detection through Viola-Jones Detector(using training data from OpenCV)

 

 Here is brief source explanation : will be updated

 

Brief Source flow of V-J face detector

 

CCVFrame class : CVFrame.cpp

        Training.cpp

               InitPossibleFeatures();

                      MakeWeakClassifier();

                              WeakClassifier;

                      LoadPrositiveExamples();

                      LoadNegativeExamples();

                      InitPositiveImage();

                                MakeIntegImage(BYTE* src, double* dst, int width, int height);

                      InitNegativeImage();

                                MakeIntegImage(BYTE* src, double* dst, int width, int height);

                BeginCascadeClassifier(); 

                      AdaBoost(n[nNode], nNode -1);

                                GetOneFeature(m_ImgPositive[j].IntegrailImage,0,0,&minsc);

CImageProc class : ImageProc.cpp

        InitCamImageBuff();

        InitVJFaceDetector();

CCVFrame class : CVFrame.cpp

         ProcFaceDetector.cpp

                OnFaceVjCam();

                       nDetecMode = MODE_VIOLA_JONES;

                         AfxBeginThread(ThreadFunc, this, THREAD_PRIORITY_NORMAL,0, 0);

                                 ThreadFunc (LPVOID pParam);

                                        VJFaceDetector(grayImg, image2, TRUE);

                                              VJFaceDetector(CvArr* image1, CvArr* image2, BOOL nFlip);

 

Brief Source flow of Morph face detector

 

CImageProc class : ImageProc.cpp

        InitCamImageBuff();

CCVFrame class : CVFrame.cpp

        nDetecMode = MODE_MORPHOLOGY_VJ;

        AfxBeginThread(ThreadFunc, this, THREAD_PRIORITY_NORMAL,0, 0);

                         ThreadFunc (LPVOID pParam);

ImageProc.cpp

EfDetection.cpp

m_ImageProc->m_EfDetection.GetEyePos(imageBuffer, w, h, &lEyeX, &lEyeY, &rEyeX, &rEyeY);

                         Scaling(imageBuffer, pSrcBuffer, .........);

                    CLAHE(tempBuffer1,........);MeanFilter(pPreprocBuffer....);Erosion(smoothingImage,......);

                                      ClosingGrayImage(pPreprocBuffer......);

                                      FilterImage(smoothingImage.........);

                    AndOperation(pThresBuffer..........);

                    ConnectedComponents(pPreprocBuffer, pLabelBuffer);

                    SetFeatureWindow(pLabelBuffer....);

                    SetEyePair(m_pFtrInfo....);

                    GroupingFeature(pSrcBuffer....);

                              MoFaceDetector(CvArr* image1, CvArr* image2 ,BOOL nFlip, BOOL bEye);