Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

image based face recognition

$
0
0
i have write the below code for reading two images from folder and apply fisherface training algorithm on them there are two person images that i have read....can anyone tell me how to proceed the code for how to recognised person between these two images ??? const char *facerecAlgorithm = "FaceRecognizer.Fisherfaces"; int main() { string facerecAlgorithm = "FaceRecognizer.Fisherfaces"; Ptr model; // Make sure the "contrib" module is dynamically loaded at runtime. // Requires OpenCV v2.4.1 or later (from June 2012), otherwise the FaceRecognizer will not compile or run! bool haveContribModule = initModule_contrib(); if (!haveContribModule) { cerr << "ERROR: The 'contrib' module is needed for FaceRecognizer but has not been loaded into OpenCV!" << endl; exit(1); } else { cout << "\ncontrib module is successfully loaded" << std::endl; } model = Algorithm::create(facerecAlgorithm); if (model.empty()) { cerr << "ERROR: The FaceRecognizer [" << facerecAlgorithm; cerr << "] is not available in your version of OpenCV. "; cerr << "Please update to OpenCV v2.4.1 or newer." << endl; exit(1); } else { cout << "\nFisherFaceRecognizer is successfully loaded" << std::endl; } cout << "\nFisherFaceRecognizer training starting......" << std::endl; // holds images and labels vector images; vector labels; // images for first person images.push_back(imread("1.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0); images.push_back(imread("3.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0); images.push_back(imread("5.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0); // images for second person images.push_back(imread("2.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(1); images.push_back(imread("4.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(1); // This is the common interface to train all of the available cv::FaceRecognizer // implementations model->train(various_images, labels); cout << "\nFisherFaceRecognizer training finished......" << std::endl; return 0; }

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>