As far as I know Samuel Audet (the JavaCV lead dev) has written a wrapper for the cv::FaceRecognizer:
You can find an example on how to use it in Petter Christian Bjelland blog:
Now to your original question. I guess the names are misleading in the old OpenCV API. Let me attempt to explain it, but first give you an advice on using the OpenCV2 C++ API. I write this as a reference to people coming here from Google, so excuse if this is a lengthy answer. This may not directly apply to you using JavaCV, but for everyone else: I strongly suggest using the new OpenCV2 interface, just because the old C API is probably not supported in the future anymore.
Instead of cvCalcEigenObjects
, cvEigenDecomposite
and cvEigenProjection
OpenCV now comes with the cv::PCA class, which makes performing a Principal Component Analysis really simple. Instead of going through it in-depth I am now pasting a sample (so people have it as a starting point) and then I'll answer your question on the old API.
This is an example to perform a Principal Component Analysis on a given set of images, in this example either with a hardcoded set of images or a CSV file. I think a modified version of this was added to the OpenCV documentation recently. By the way you'll find a source code example on using cv::PCA::project and cv::PCA::backProject in the documentation on cv::PCA:
/*
* Copyright (c) 2012. Philipp Wagner <bytefish[at]gmx[dot]de>.
* Released to public domain under terms of the BSD Simplified license.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the organization nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* See <http://www.opensource.org/licenses/bsd-license>
*/
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <fstream>
#include <sstream>
using namespace cv;
using namespace std;
// Reads the images and labels from a given CSV file, a valid file would
// look like this:
//
// /path/to/person0/image0.jpg;0
// /path/to/person0/image1.jpg;0
// /path/to/person1/image0.jpg;1
// /path/to/person1/image1.jpg;1
// ...
//
void read_csv(const string& filename, vector<Mat>& images, vector<int>& labels) {
std::ifstream file(filename.c_str(), ifstream::in);
if(!file)
throw std::exception();
std::string line, path, classlabel;
// For each line in the given file:
while (std::getline(file, line)) {
// Get the current line:
std::stringstream liness(line);
// Split it at the semicolon:
std::getline(liness, path, ';');
std::getline(liness ...
(more)