Loading...
Searching...
No Matches
cv::face::EigenFaceRecognizer Class Reference
#include <opencv2/face/facerec.hpp>
Inheritance diagram for cv::face::EigenFaceRecognizer:

Static Public Member Functions | |
static Ptr< EigenFaceRecognizer > | create (int num_components=0, double threshold=DBL_MAX) |
![]() | |
template<typename _Tp > | |
static Ptr< _Tp > | load (const String &filename, const String &objname=String()) |
Loads algorithm from the file. | |
template<typename _Tp > | |
static Ptr< _Tp > | loadFromString (const String &strModel, const String &objname=String()) |
Loads algorithm from a String. | |
template<typename _Tp > | |
static Ptr< _Tp > | read (const FileNode &fn) |
Reads algorithm from the file node. | |
Additional Inherited Members | |
![]() | |
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::Mat > | getProjections () const |
double | getThreshold () const CV_OVERRIDE |
virtual void | read (const FileNode &fn) CV_OVERRIDE |
virtual void | read (const FileNode &fn) CV_OVERRIDE=0 |
virtual void | read (const String &filename) |
Loads a FaceRecognizer and its model state. | |
void | setNumComponents (int val) |
void | setThreshold (double val) CV_OVERRIDE |
virtual void | write (const String &filename) const |
Saves a FaceRecognizer and its model state. | |
virtual void | write (FileStorage &fs) const CV_OVERRIDE |
virtual void | write (FileStorage &fs) const CV_OVERRIDE=0 |
![]() | |
virtual bool | empty () const CV_OVERRIDE=0 |
virtual String | getLabelInfo (int label) const |
Gets string information by label. | |
virtual std::vector< int > | getLabelsByString (const String &str) const |
Gets vector of labels by string. | |
virtual double | getThreshold () const =0 |
threshold parameter accessor - required for default BestMinDist collector | |
int | predict (InputArray src) const |
void | predict (InputArray src, int &label, double &confidence) const |
Predicts a label and associated confidence (e.g. distance) for a given input image. | |
virtual void | predict (InputArray src, Ptr< PredictCollector > collector) const =0 |
| |
virtual void | read (const FileNode &fn) CV_OVERRIDE=0 |
virtual void | read (const String &filename) |
Loads a FaceRecognizer and its model state. | |
virtual void | setLabelInfo (int label, const String &strInfo) |
Sets string info for the specified model's label. | |
virtual void | setThreshold (double val)=0 |
Sets threshold of model. | |
virtual void | train (InputArrayOfArrays src, InputArray labels)=0 |
Trains a FaceRecognizer with given data and associated labels. | |
virtual void | update (InputArrayOfArrays src, InputArray labels) |
Updates a FaceRecognizer with given data and associated labels. | |
virtual void | write (const String &filename) const |
Saves a FaceRecognizer and its model state. | |
virtual void | write (FileStorage &fs) const CV_OVERRIDE=0 |
![]() | |
Algorithm () | |
virtual | ~Algorithm () |
virtual void | clear () |
Clears the algorithm state. | |
virtual bool | empty () const |
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. | |
virtual String | getDefaultName () const |
virtual void | read (const FileNode &fn) |
Reads algorithm parameters from a file storage. | |
virtual void | save (const String &filename) const |
void | write (const Ptr< FileStorage > &fs, const String &name=String()) const |
virtual void | write (FileStorage &fs) const |
Stores algorithm parameters in a file storage. | |
void | write (FileStorage &fs, const String &name) const |
![]() | |
void | writeFormat (FileStorage &fs) const |
![]() | |
Mat | _eigenvalues |
Mat | _eigenvectors |
Mat | _labels |
Mat | _mean |
int | _num_components |
std::vector< Mat > | _projections |
double | _threshold |
![]() | |
std::map< int, String > | _labelsInfo |
Member Function Documentation
◆ create()
|
static |
- Parameters
-
num_components The 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. threshold The 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:
- opencv2/face/facerec.hpp