Sunday, May 6, 2012

OpenCV Face Recognition using PCA technique


Step 1 :  Download and Install OpenCV 2.1.0 .
              OpenCV 2.1.0 installation on Visual Studio 2008 guide is here .

Step 2 :  Start with a new C++ Console win32 Application project on Visual studio.
              Then create a new  NearestTest.cpp   file within that project.

Step 3 :  Then create a face database with using several images as follows,
              Database folder  ->     

                             
    
                     


Step 4 : Mainly this app consisting with two parts,
                     1. Image Training Part  -
                                  first you have to train Face Images from train.txt
                                  training images.
                           ->   learn()  method                            
                     2. Image Recognition Part -
                                 then using test.txt testing images, recognize each
                                 and every face through training images (facedata.xml).
                           ->  recognize() method

               

- After doing training ->  it will create facedata.xml with using PCA technique.
- Then using facedata.xml, recognition will be done.


Step 5 :  Create the Project Folder Structure as follows and then download all the
              coding stuffs from  above and then add to NearestTest.cpp file.

             

Step 6 : After creating folder structure and .cpp file build the whole project.
                1. first train the images-->  facedata.xml will be generated.
      

              2. then test the app using test images--> output is as follows,