Wednesday, October 30, 2024

Computer Vision - Face Recognition - Eigenfaces by C++

 

OpenCV 4.10.0 now comes with the very new FaceRecognizer class for face recognition, so we can start experimenting with face recognition right away... Full detail at https://docs.opencv.org/3.4/da/d60/tutorial_face_main.html


The Principal Component Analysis (PCA), which is the core of the Eigenfaces method, finds a linear combination of features that maximizes the total variance in data. While this is clearly a powerful way to represent data, it doesn't consider any classes and so a lot of discriminative information may be lost when throwing components away. Imagine a situation where the variance in your data is generated by an external source, let it be the light. The components identified by a PCA do not necessarily contain any discriminative information at all, so the projected samples are smeared together and a classification becomes impossible (see https://www.bytefish.de/pdf/facerec_octave.pdf for an example).


The code of Eigenfaces by C++ look like



run [cmake ..]





run [cmake --build .]




we do #include "opencv2/face.hpp" the library for face not include with OpenCV so the error LINK2019

face module from opencv_contrib



After do join and rebuild OpenCV with OpenCV Contribute we get the lib(s) of them look like




Run [cmake ..] again with lib(s) of both OpenCV and OpenCV Contribute





Run [cmake --build .] is OK now with lib(s) from both OpenCV and OpenCV Contribute




Run EigenFaces FaceRecognition with 10 input images and get result look like





Natural Language Processing service + Generative AI Chatbot +Computer Vision + Machine Learning + Mobile App + Web App? Yes, I do provide!


Call me: +84854147015

WhatsApp: +601151992689

https://amatasiam.web.app

Email: ThomasTrungVo@Gmail.Com






No comments:

Post a Comment