Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Trying to use face recognition, the facerecognizer

So I copied from http://docs.opencv.org/trunk/modules/contrib/doc/facerec/facerec_api.html

 // Let's say we want to keep 10 Eigenfaces and have a threshold value of 10.0
 int num_components = 10;
 double threshold = 10.0;
 // Then if you want to have a cv::FaceRecognizer with a confidence threshold,
 // create the concrete implementation with the appropiate parameters:
 Ptr<FaceRecognizer> model = createEigenFaceRecognizer(num_components, threshold);

 // The following line reads the threshold from the Eigenfaces model:
 double current_threshold = model->getDouble("threshold");
 // And this line sets the threshold to 0.0:
 model->set("threshold", 0.0);

 // Create a FaceRecognizer:
 Ptr<FaceRecognizer> model = createEigenFaceRecognizer();
 // And here's how to get its name:
 String name = model->name();

 // holds images and labels
 vector<Mat> images;
 vector<int> labels;
 // images for first person
 images.push_back(imread("/var/www/html/photos/1.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/2.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/3.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/4.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/5.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/6.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/7.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/8.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/9.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/10.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/11.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/12.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/13.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/14.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/15.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/16.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/17.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/19.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/20.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/21.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/22.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/23.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/24.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/25.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/26.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/27.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/28.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/29.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/30.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/31.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/32.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/33.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/34.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/35.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/36.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/37.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/38.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);

 // Create a new Fisherfaces model and retain all available Fisherfaces,
 // this is the most common usage of this specific FaceRecognizer:
 //
 Ptr<FaceRecognizer> model =  createFisherFaceRecognizer();

 // This is the common interface to train all of the available cv::FaceRecognizer
 // implementations:
 //
 model->train(images, labels);

 FaceRecognizer::save("/var/www/html/photos/saved.txt");

Tried to compile that expecting to run it and see the contents of "saved.txt" to later store on a mysql database and do a rerun of this again with any new tagged image (using face detection) that ends up corresponding to the stored value on the database.. but this is all in diapers. I got all of the following errors when trying to compile the code above:

facerecog.c:6: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<'                                                                                                              token
facerecog.c:9: error: 'model' undeclared here (not in a function)
facerecog.c:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '-                                                                                                             >' token
facerecog.c:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<                                                                                                             ' token
facerecog.c:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'n                                                                                                             ame'
facerecog.c:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<                                                                                                             ' token
facerecog.c:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<                                                                                                             ' token
facerecog.c:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:28: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:28: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:29: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:29: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:32: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:32: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:33: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:33: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:34: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:34: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:35: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:35: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:36: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:36: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:39: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:39: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:40: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:40: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:41: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:41: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:42: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:42: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:43: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:43: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:44: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:44: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:45: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:45: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:46: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:46: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:47: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:47: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:48: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:48: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:49: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:49: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:50: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:50: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:51: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:51: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:52: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:52: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:53: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:53: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:54: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:54: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:55: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:55: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:56: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:56: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:57: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:57: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:58: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:58: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:63: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<                                                                                                             ' token
facerecog.c:68: error: expected '=', ',', ';', 'asm' or '__attribute__' before '-                                                                                                             >' token
facerecog.c:70: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':                                                                                                             ' token

Trying to use face recognition, the facerecognizer

So I copied from http://docs.opencv.org/trunk/modules/contrib/doc/facerec/facerec_api.html

 // Let's say we want to keep 10 Eigenfaces and have a threshold value of 10.0
 int num_components = 10;
 double threshold = 10.0;
 // Then if you want to have a cv::FaceRecognizer with a confidence threshold,
 // create the concrete implementation with the appropiate parameters:
 Ptr<FaceRecognizer> model = createEigenFaceRecognizer(num_components, threshold);

 // The following line reads the threshold from the Eigenfaces model:
 double current_threshold = model->getDouble("threshold");
 // And this line sets the threshold to 0.0:
 model->set("threshold", 0.0);

 // Create a FaceRecognizer:
 Ptr<FaceRecognizer> model = createEigenFaceRecognizer();
 // And here's how to get its name:
 String name = model->name();

 // holds images and labels
 vector<Mat> images;
 vector<int> labels;
 // images for first person
 images.push_back(imread("/var/www/html/photos/1.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/2.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/3.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/4.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/5.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/6.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/7.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/8.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/9.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/10.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/11.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/12.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/13.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/14.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/15.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/16.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/17.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/19.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/20.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/21.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/22.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/23.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/24.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/25.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/26.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/27.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/28.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/29.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/30.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/31.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/32.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/33.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/34.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/35.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/36.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/37.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/38.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);

 // Create a new Fisherfaces model and retain all available Fisherfaces,
 // this is the most common usage of this specific FaceRecognizer:
 //
 Ptr<FaceRecognizer> model =  createFisherFaceRecognizer();

 // This is the common interface to train all of the available cv::FaceRecognizer
 // implementations:
 //
 model->train(images, labels);

 FaceRecognizer::save("/var/www/html/photos/saved.txt");

Tried to compile that expecting to run it and see the contents of "saved.txt" to later store on a mysql database and do a rerun of this again with any new tagged image (using face detection) that ends up corresponding to the stored value on the database.. but this is all in diapers. I got all of the following errors when trying to compile the code above:

facerecog.c:6: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<'                                                                                                              token
facerecog.c:9: error: 'model' undeclared here (not in a function)
facerecog.c:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '-                                                                                                             >' token
facerecog.c:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<                                                                                                             ' token
facerecog.c:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'n                                                                                                             ame'
facerecog.c:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<                                                                                                             ' token
facerecog.c:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<                                                                                                             ' token
facerecog.c:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:28: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:28: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:29: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:29: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:32: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:32: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:33: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:33: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:34: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:34: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:35: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:35: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:36: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:36: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:39: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:39: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:40: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:40: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:41: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:41: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:42: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:42: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:43: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:43: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:44: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:44: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:45: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:45: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:46: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:46: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:47: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:47: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:48: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:48: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:49: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:49: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:50: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:50: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:51: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:51: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:52: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:52: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:53: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:53: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:54: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:54: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:55: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:55: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:56: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:56: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:57: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:57: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:58: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:58: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:63: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<                                                                                                             ' token
facerecog.c:68: error: expected '=', ',', ';', 'asm' or '__attribute__' before '-                                                                                                             >' token
facerecog.c:70: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':                                                                                                             ' token

Using g++ I get the next errors:

/var/www/html/fotos/facerecog.c:11: error: expected constructor, destructor, or t             ype conversion before '<' token
/var/www/html/fotos/facerecog.c:14: error: 'model' was not declared in this scope
/var/www/html/fotos/facerecog.c:16: error: expected constructor, destructor, or t             ype conversion before '->' token
/var/www/html/fotos/facerecog.c:19: error: expected constructor, destructor, or t             ype conversion before '<' token
/var/www/html/fotos/facerecog.c:21: error: 'String' does not name a type
/var/www/html/fotos/facerecog.c:24: error: expected constructor, destructor, or t             ype conversion before '<' token
/var/www/html/fotos/facerecog.c:25: error: expected constructor, destructor, or t             ype conversion before '<' token
/var/www/html/fotos/facerecog.c:27: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:27: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:28: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:28: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:29: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:29: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:30: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:30: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:31: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:31: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:32: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:32: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:33: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:33: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:34: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:34: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:35: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:35: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:36: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:36: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:37: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:37: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:38: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:38: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:39: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:39: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:40: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:40: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:41: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:41: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:42: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:42: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:43: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:43: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:44: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:44: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:45: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:45: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:46: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:46: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:47: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:47: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:48: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:48: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:49: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:49: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:50: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:50: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:51: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:51: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:52: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:52: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:53: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:53: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:54: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:54: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:55: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:55: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:56: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:56: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:57: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:57: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:58: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:58: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:59: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:59: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:60: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:60: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:61: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:61: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:62: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:62: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:63: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:63: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:68: error: expected constructor, destructor, or t             ype conversion before '<' token
/var/www/html/fotos/facerecog.c:73: error: expected constructor, destructor, or t             ype conversion before '->' token
/var/www/html/fotos/facerecog.c:75: error: 'FaceRecognizer' has not been declared
/var/www/html/fotos/facerecog.c:75: error: expected constructor, destructor, or t             ype conversion before '(' token
click to hide/show revision 3
retagged

updated 2013-09-16 13:15:11 -0600

berak gravatar image

Trying to use face recognition, the facerecognizer

So I copied from http://docs.opencv.org/trunk/modules/contrib/doc/facerec/facerec_api.html

 // Let's say we want to keep 10 Eigenfaces and have a threshold value of 10.0
 int num_components = 10;
 double threshold = 10.0;
 // Then if you want to have a cv::FaceRecognizer with a confidence threshold,
 // create the concrete implementation with the appropiate parameters:
 Ptr<FaceRecognizer> model = createEigenFaceRecognizer(num_components, threshold);

 // The following line reads the threshold from the Eigenfaces model:
 double current_threshold = model->getDouble("threshold");
 // And this line sets the threshold to 0.0:
 model->set("threshold", 0.0);

 // Create a FaceRecognizer:
 Ptr<FaceRecognizer> model = createEigenFaceRecognizer();
 // And here's how to get its name:
 String name = model->name();

 // holds images and labels
 vector<Mat> images;
 vector<int> labels;
 // images for first person
 images.push_back(imread("/var/www/html/photos/1.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/2.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/3.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/4.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/5.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/6.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/7.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/8.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/9.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/10.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/11.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/12.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/13.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/14.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/15.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/16.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/17.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/19.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/20.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/21.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/22.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/23.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/24.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/25.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/26.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/27.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/28.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/29.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/30.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/31.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/32.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/33.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/34.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/35.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/36.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/37.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/38.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);

 // Create a new Fisherfaces model and retain all available Fisherfaces,
 // this is the most common usage of this specific FaceRecognizer:
 //
 Ptr<FaceRecognizer> model =  createFisherFaceRecognizer();

 // This is the common interface to train all of the available cv::FaceRecognizer
 // implementations:
 //
 model->train(images, labels);

 FaceRecognizer::save("/var/www/html/photos/saved.txt");

Tried to compile that expecting to run it and see the contents of "saved.txt" to later store on a mysql database and do a rerun of this again with any new tagged image (using face detection) that ends up corresponding to the stored value on the database.. but this is all in diapers. I got all of the following errors when trying to compile the code above:

facerecog.c:6: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<'                                                                                                              token
facerecog.c:9: error: 'model' undeclared here (not in a function)
facerecog.c:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '-                                                                                                             >' token
facerecog.c:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<                                                                                                             ' token
facerecog.c:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'n                                                                                                             ame'
facerecog.c:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<                                                                                                             ' token
facerecog.c:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<                                                                                                             ' token
facerecog.c:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:28: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:28: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:29: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:29: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:32: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:32: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:33: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:33: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:34: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:34: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:35: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:35: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:36: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:36: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:39: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:39: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:40: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:40: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:41: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:41: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:42: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:42: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:43: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:43: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:44: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:44: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:45: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:45: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:46: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:46: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:47: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:47: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:48: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:48: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:49: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:49: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:50: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:50: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:51: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:51: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:52: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:52: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:53: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:53: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:54: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:54: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:55: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:55: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:56: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:56: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:57: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:57: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:58: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:58: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.                                                                                                             ' token
facerecog.c:63: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<                                                                                                             ' token
facerecog.c:68: error: expected '=', ',', ';', 'asm' or '__attribute__' before '-                                                                                                             >' token
facerecog.c:70: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':                                                                                                             ' token

Using g++ I get the next errors:

/var/www/html/fotos/facerecog.c:11: error: expected constructor, destructor, or t             ype conversion before '<' token
/var/www/html/fotos/facerecog.c:14: error: 'model' was not declared in this scope
/var/www/html/fotos/facerecog.c:16: error: expected constructor, destructor, or t             ype conversion before '->' token
/var/www/html/fotos/facerecog.c:19: error: expected constructor, destructor, or t             ype conversion before '<' token
/var/www/html/fotos/facerecog.c:21: error: 'String' does not name a type
/var/www/html/fotos/facerecog.c:24: error: expected constructor, destructor, or t             ype conversion before '<' token
/var/www/html/fotos/facerecog.c:25: error: expected constructor, destructor, or t             ype conversion before '<' token
/var/www/html/fotos/facerecog.c:27: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:27: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:28: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:28: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:29: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:29: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:30: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:30: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:31: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:31: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:32: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:32: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:33: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:33: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:34: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:34: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:35: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:35: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:36: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:36: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:37: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:37: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:38: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:38: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:39: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:39: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:40: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:40: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:41: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:41: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:42: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:42: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:43: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:43: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:44: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:44: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:45: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:45: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:46: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:46: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:47: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:47: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:48: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:48: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:49: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:49: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:50: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:50: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:51: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:51: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:52: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:52: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:53: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:53: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:54: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:54: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:55: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:55: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:56: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:56: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:57: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:57: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:58: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:58: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:59: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:59: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:60: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:60: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:61: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:61: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:62: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:62: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:63: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:63: error: expected constructor, destructor, or t             ype conversion before '.' token
/var/www/html/fotos/facerecog.c:68: error: expected constructor, destructor, or t             ype conversion before '<' token
/var/www/html/fotos/facerecog.c:73: error: expected constructor, destructor, or t             ype conversion before '->' token
/var/www/html/fotos/facerecog.c:75: error: 'FaceRecognizer' has not been declared
/var/www/html/fotos/facerecog.c:75: error: expected constructor, destructor, or t             ype conversion before '(' token