Basic Face Detection and Face Recognition Using OpenCV

Basic Face Detection and Face Recognition Using OpenCV

Detect faces and their eyes, nose and mouth in a web cam feed. Then calculate the rotation of each face. Next you can also capture the faces and store them in a format suitable for recognition. I then demonstrate working face recognition. This is done using OpenCV, the code is open-source and you can get it at: If you use it I would be happy to receive a notification of that. If you modify it, you are very welcome to commit your changes! Look at my website for a basic post of the framework: If you have trouble compiling OpenCV with visual studio 2010, look at: For information about compiling Boost with visual studio 2010, look at: I found the information and explanations about face detection, face tracking and face recognition from Robin Hewitt very useful:
Video Rating: 4 / 5

18 thoughts on “Basic Face Detection and Face Recognition Using OpenCV

  1. hello,it’s great work! Now I follow your steps to let the window comes out,but my webcam cann’t connect with it.I don’t konw how to connect it with webcam.Can you help me?Thanks very much.

  2. Hey nishant, I won’t be able to provide you with help, I am too limited in time, You could add code to do expression recognition, but you’d have to write that yourself.

  3. hiiiiiiii,,,,,,,great work could u plz tell me that  u r code can be modified in to expression recognition………or any other help from u r side……

  4. It fixed that problem when using an older version. However, a new problem occured: 1>cognitiondetectordetailedfacedetector.cpp(118): error C2248: ‘DO_CANNY_PRUNING’ : cannot access protected enumerator declared in class ‘cv::CascadeClassifier’ 1> C:OpenCV 2.4.3buildincludeopencv2/objdetect/objdetect.hpp(411) : see declaration of ‘DO_CANNY_PRUNING’ 1> C:OpenCV 2.4.3buildincludeopencv2/objdetect/objdetect.hpp(369) : see declaration of ‘cv::CascadeClassifier’

  5. I have no idea why that would fail, maybe you should look into boost::filesystem maybe you are using a version that has removed the method (if it does not compile) or if it gives you problems at runtime, the method’s behavior might have changed. That’s all I can guess..

  6. I succesfully installed all the needed packages, and I almost got the face detection system to work. However, one problem remains; the visualcontrol.cpp file. ___________________________________________ for(directory_iterator file(dir); file != end; ++file){ if(is_regular_file(*file)) recognizer->addTrainingImage(file->path().string(), file->filename()); } ___________________________________________ “filename” cannot be located as far as I can see—any idea how to fix this problem?

  7. How can i get the source code from this program. I’m trying create a project that capture mutiple images from webcam using Microsoft Visual Studio c++ 2010 Express using OpenCV librarie… Can anyone help me please?

Leave a Reply