OpenCV  4.1.0
Open Source Computer Vision
Static Public Member Functions | List of all members
cv::face::EigenFaceRecognizer Class Reference

#include <opencv2/face/facerec.hpp>

Inheritance diagram for cv::face::EigenFaceRecognizer:
cv::face::BasicFaceRecognizer cv::face::FaceRecognizer cv::Algorithm

Static Public Member Functions

static Ptr< EigenFaceRecognizercreate (int num_components=0, double threshold=DBL_MAX)
 

Additional Inherited Members

- Public Member Functions inherited from cv::face::BasicFaceRecognizer
virtual bool empty () const CV_OVERRIDE
 
cv::Mat getEigenValues () const
 
cv::Mat getEigenVectors () const
 
cv::Mat getLabels () const
 
cv::Mat getMean () const
 
int getNumComponents () const
 
std::vector< cv::MatgetProjections () const
 
double getThreshold () const CV_OVERRIDE
 
virtual void read (const FileNode &fn) CV_OVERRIDE
 
void setNumComponents (int val)
 
void setThreshold (double val) CV_OVERRIDE
 
virtual void write (FileStorage &fs) const CV_OVERRIDE
 
- Protected Member Functions inherited from cv::Algorithm
void writeFormat (FileStorage &fs) const
 
- Protected Attributes inherited from cv::face::BasicFaceRecognizer
Mat _eigenvalues
 
Mat _eigenvectors
 
Mat _labels
 
Mat _mean
 
int _num_components
 
std::vector< Mat_projections
 
double _threshold
 

Member Function Documentation

static Ptr<EigenFaceRecognizer> cv::face::EigenFaceRecognizer::create ( int  num_components = 0,
double  threshold = DBL_MAX 
)
static
Python:
retval=cv.face.EigenFaceRecognizer_create([, num_components[, threshold]])
Parameters
num_componentsThe number of components (read: Eigenfaces) kept for this Principal Component Analysis. As a hint: There's no rule how many components (read: Eigenfaces) should be kept for good reconstruction capabilities. It is based on your input data, so experiment with the number. Keeping 80 components should almost always be sufficient.
thresholdThe threshold applied in the prediction.

Notes:

  • Training and prediction must be done on grayscale images, use cvtColor to convert between the color spaces.
  • THE EIGENFACES METHOD MAKES THE ASSUMPTION, THAT THE TRAINING AND TEST IMAGES ARE OF EQUAL SIZE. (caps-lock, because I got so many mails asking for this). You have to make sure your input data has the correct shape, else a meaningful exception is thrown. Use resize to resize the images.
  • This model does not support updating.

Model internal data:

  • num_components see EigenFaceRecognizer::create.
  • threshold see EigenFaceRecognizer::create.
  • eigenvalues The eigenvalues for this Principal Component Analysis (ordered descending).
  • eigenvectors The eigenvectors for this Principal Component Analysis (ordered by their eigenvalue).
  • mean The sample mean calculated from the training data.
  • projections The projections of the training data.
  • labels The threshold applied in the prediction. If the distance to the nearest neighbor is larger than the threshold, this method returns -1.

The documentation for this class was generated from the following file: