samples/IFaceTest/PhotoIndexingUtility.cpp
////////////////////////////////////////////////////////////////////////////////////////
/// This routine is a function of the Photo indexing Utility
///  written by Ren Haibing 
///   the face model is in the default directory
/// Acknowledge		:
///
/// Function name	: FaceRegistration_Init
/// Description	    : init IflibFaceAnalyzer for face registration  
///
/// Argument		:	
///
/// Return type		: 
///
/// Create Time		: 2014-11-18  10:20
///
///
/// Side Effect		: 
///
///////////////////////////////////////////////////////////////////////////////////////////////
This routine is a function of the Photo indexing Utility
written by Ren Haibing
the face model is in the default directory
Acknowledge            .

Function name  : FaceRegistration_Init
Description        : init IflibFaceAnalyzer for face registration

Argument               .

Return type            .



Side Effect            .
This routine is a function of the Photo indexing Utility written by Ren Haibing the face model is in the default directory Acknowledge . Function name : FaceRegistration_Init Description : init IflibFaceAnalyzer for face registration Argument . Return type . Side Effect .
bool PhotoIndexing_Init(string& configure_file)
{
	if (configure_file.empty())
	{
		fprintf(stderr, "please confirm your configure file\n");
		return false;
	}
	cv::FileStorage fs;
	string opencv_input_facemod;
	string opencv_input_blinkmod;
	string opencv_input_smilemod;
	string opencv_input_gendermod;
	string opencv_input_agemod;
	string opencv_input_xmlEyeLeftCorner;
	string opencv_input_xmlMthLeftCorner;
	string opencv_input_xmlNose;
	string opencv_input_newSkinLookupTable;
	fs.open(configure_file.c_str(), cv::FileStorage::READ);
	if (!fs.isOpened())
	{
		fprintf(stderr, "invalid configure file: %s\n", configure_file.c_str());
		return false;
	}
	fs["thumbnail"] >> thumbnail;
	fs["faceTestDir"] >> faceTestDir;
	fs["faceModelXML"] >> faceModelXML;
	fs["opencv_input_facemod"] >> opencv_input_facemod;
	fs["opencv_input_blinkmod"] >> opencv_input_blinkmod;
	fs["opencv_input_smilemod"] >> opencv_input_smilemod;
	fs["opencv_input_gendermod"] >> opencv_input_gendermod;
	fs["opencv_input_agemod"] >> opencv_input_agemod;
	fs["opencv_input_xmlEyeLeftCorner"] >> opencv_input_xmlEyeLeftCorner;
	fs["opencv_input_xmlMthLeftCorner"] >> opencv_input_xmlMthLeftCorner;
	fs["opencv_input_xmlNose"] >> opencv_input_xmlNose;
	fs["opencv_input_newSkinLookupTable"] >> opencv_input_newSkinLookupTable;
	fs.release();
	const char *str_faceModelXML = faceModelXML.c_str();
	fstream ifs;
	ifs.open(str_faceModelXML, fstream::in);
	if (!ifs.is_open())
	{
		fprintf(stderr, "can not open faceModelXML file: %s\n", str_faceModelXML);
		return false;
	}
	cout << "Begin Photo Indexing Initialization " << endl;
	InitFaceRecognition(opencv_input_facemod.c_str(), opencv_input_blinkmod.c_str(), opencv_input_smilemod.c_str(), opencv_input_gendermod.c_str(), opencv_input_agemod.c_str(), opencv_input_xmlEyeLeftCorner.c_str(), opencv_input_xmlMthLeftCorner.c_str(), opencv_input_xmlNose.c_str(), str_faceModelXML);
	InitFaceDetector(opencv_input_newSkinLookupTable.c_str());
	FaceRegistration_Init(str_faceModelXML, opencv_input_xmlEyeLeftCorner.c_str(), opencv_input_xmlMthLeftCorner.c_str(), opencv_input_facemod.c_str());
	cout << "Finish photo indexing initialization  " << endl << endl;
	return true;
}
bool PhotoIndexing_Init ( string & configure_file ) { if ( configure_file . empty ( ) ) { fprintf ( stderr , " \n " ) ; return false ; } cv :: FileStorage fs ; string opencv_input_facemod ; string opencv_input_blinkmod ; string opencv_input_smilemod ; string opencv_input_gendermod ; string opencv_input_agemod ; string opencv_input_xmlEyeLeftCorner ; string opencv_input_xmlMthLeftCorner ; string opencv_input_xmlNose ; string opencv_input_newSkinLookupTable ; fs . open ( configure_file . c_str ( ) , cv :: FileStorage :: READ ) ; if ( ! fs . isOpened ( ) ) { fprintf ( stderr , " \n " , configure_file . c_str ( ) ) ; return false ; } fs [ " " ] >> thumbnail ; fs [ " " ] >> faceTestDir ; fs [ " " ] >> faceModelXML ; fs [ " " ] >> opencv_input_facemod ; fs [ " " ] >> opencv_input_blinkmod ; fs [ " " ] >> opencv_input_smilemod ; fs [ " " ] >> opencv_input_gendermod ; fs [ " " ] >> opencv_input_agemod ; fs [ " " ] >> opencv_input_xmlEyeLeftCorner ; fs [ " " ] >> opencv_input_xmlMthLeftCorner ; fs [ " " ] >> opencv_input_xmlNose ; fs [ " " ] >> opencv_input_newSkinLookupTable ; fs . release ( ) ; const char * str_faceModelXML = faceModelXML . c_str ( ) ; fstream ifs ; ifs . open ( str_faceModelXML , fstream :: in ) ; if ( ! ifs . is_open ( ) ) { fprintf ( stderr , " \n " , str_faceModelXML ) ; return false ; } cout << " " << endl ; InitFaceRecognition ( opencv_input_facemod . c_str ( ) , opencv_input_blinkmod . c_str ( ) , opencv_input_smilemod . c_str ( ) , opencv_input_gendermod . c_str ( ) , opencv_input_agemod . c_str ( ) , opencv_input_xmlEyeLeftCorner . c_str ( ) , opencv_input_xmlMthLeftCorner . c_str ( ) , opencv_input_xmlNose . c_str ( ) , str_faceModelXML ) ; InitFaceDetector ( opencv_input_newSkinLookupTable . c_str ( ) ) ; FaceRegistration_Init ( str_faceModelXML , opencv_input_xmlEyeLeftCorner . c_str ( ) , opencv_input_xmlMthLeftCorner . c_str ( ) , opencv_input_facemod . c_str ( ) ) ; cout << " " << endl << endl ; return true ; }
This routine is a function of the Photo indexing Utility
written by Ren Haibing
the face model is in the default directory
Acknowledge            :
This routine is a function of the Photo indexing Utility written by Ren Haibing the face model is in the default directory Acknowledge :
// Face Recognition ------------------------------------------------------- // Face Detector --------------------------------------------- //scene classification -------------------------------------------------------- //initializeScene("./scene_model"); //Registration