| OpenCV 5.0.0alpha Open Source Computer Vision

Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
cv::face::BasicFaceRecognizer Class Reference
Face Analysis

`#include <opencv2/face/facerec.hpp>`

Collaboration diagram for cv::face::BasicFaceRecognizer:

## Public Member Functions
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 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
Public Member Functions inherited from cv::face::FaceRecognizer
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.
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
| if implemented - send all result of prediction to collector that can be used for somehow custom result handling
virtual void | setLabelInfo (int label, const String &strInfo)
| Sets string info for the specified model's label.
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.
Public Member Functions inherited from cv::Algorithm
| Algorithm ()
virtual | ~Algorithm ()
virtual void | clear ()
| Clears the algorithm state.
virtual String | getDefaultName () const
virtual void | save (const String &filename) const
void | write (FileStorage &fs, const String &name) const

## Protected Attributes
Mat | _eigenvalues
Mat | _eigenvectors
Mat | _labels
Mat | _mean
int | _num_components
std::vector< Mat > | _projections
double | _threshold
Protected Attributes inherited from cv::face::FaceRecognizer
std::map< int, String > | _labelsInfo

## Additional Inherited Members
Static Public Member Functions inherited from cv::Algorithm
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.
Protected Member Functions inherited from cv::Algorithm
void | writeFormat (FileStorage &fs) const

## Member Function Documentation

## ◆ empty()

virtual bool cv::face::BasicFaceRecognizer::empty | ( |  | ) | const
| virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Implements cv::face::FaceRecognizer.

## ◆ getEigenValues()

cv::Mat cv::face::BasicFaceRecognizer::getEigenValues | ( |  | ) | const

Python:
| cv.face.BasicFaceRecognizer.getEigenValues( |  | ) -> | retval

## ◆ getEigenVectors()

cv::Mat cv::face::BasicFaceRecognizer::getEigenVectors | ( |  | ) | const

Python:
| cv.face.BasicFaceRecognizer.getEigenVectors( |  | ) -> | retval

## ◆ getLabels()

cv::Mat cv::face::BasicFaceRecognizer::getLabels | ( |  | ) | const

Python:
| cv.face.BasicFaceRecognizer.getLabels( |  | ) -> | retval

## ◆ getMean()

cv::Mat cv::face::BasicFaceRecognizer::getMean | ( |  | ) | const

Python:
| cv.face.BasicFaceRecognizer.getMean( |  | ) -> | retval

## ◆ getNumComponents()

int cv::face::BasicFaceRecognizer::getNumComponents | ( |  | ) | const

Python:
| cv.face.BasicFaceRecognizer.getNumComponents( |  | ) -> | retval

See also
  setNumComponents

## ◆ getProjections()

std::vector< cv::Mat > cv::face::BasicFaceRecognizer::getProjections | ( |  | ) | const

Python:
| cv.face.BasicFaceRecognizer.getProjections( |  | ) -> | retval

## ◆ getThreshold()

double cv::face::BasicFaceRecognizer::getThreshold | ( |  | ) | const
| virtual

Python:
| cv.face.BasicFaceRecognizer.getThreshold( |  | ) -> | retval

See also
  setThreshold

Implements cv::face::FaceRecognizer.

## ◆ read() [1/2]

virtual void cv::face::BasicFaceRecognizer::read | ( | const FileNode & | fn | ) |
| virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Implements cv::face::FaceRecognizer.

## ◆ read() [2/2]

virtual void cv::face::FaceRecognizer::read | ( | const String & | filename | ) |
| virtual

Loads a FaceRecognizer and its model state.

Loads a persisted model and state from a given XML or YAML file . Every FaceRecognizer has to overwrite FaceRecognizer::load(FileStorage& fs) to enable loading the model state. FaceRecognizer::load(FileStorage& fs) in turn gets called by FaceRecognizer::load(const String& filename), to ease saving a model.

Reimplemented from cv::face::FaceRecognizer.

## ◆ setNumComponents()

void cv::face::BasicFaceRecognizer::setNumComponents | ( | int | val | ) |

Python:
| cv.face.BasicFaceRecognizer.setNumComponents( | val | ) -> | None

See also
  getNumComponents

## ◆ setThreshold()

void cv::face::BasicFaceRecognizer::setThreshold | ( | double | val | ) |
| virtual

Python:
| cv.face.BasicFaceRecognizer.setThreshold( | val | ) -> | None

See also
  getThreshold

Implements cv::face::FaceRecognizer.

## ◆ write() [1/2]

virtual void cv::face::FaceRecognizer::write | ( | const String & | filename | ) | const
| virtual

Saves a FaceRecognizer and its model state.

Saves this model to a given filename, either as XML or YAML.

Parameters

  filename | The filename to store this FaceRecognizer to (either XML/YAML).

Every FaceRecognizer overwrites FaceRecognizer::save(FileStorage& fs) to save the internal model state. FaceRecognizer::save(const String& filename) saves the state of a model to the given filename.

The suffix const means that prediction does not affect the internal model state, so the method can be safely called from within different threads.

Reimplemented from cv::face::FaceRecognizer.

## ◆ write() [2/2]

virtual void cv::face::BasicFaceRecognizer::write | ( | FileStorage & | fs | ) | const
| virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Saves this model to a given FileStorage.

Parameters

  fs | The FileStorage to store this FaceRecognizer to.

Implements cv::face::FaceRecognizer.

## Member Data Documentation

## ◆ _eigenvalues

Mat cv::face::BasicFaceRecognizer::_eigenvalues
| protected

## ◆ _eigenvectors

Mat cv::face::BasicFaceRecognizer::_eigenvectors
| protected

## ◆ _labels

Mat cv::face::BasicFaceRecognizer::_labels
| protected

## ◆ _mean

Mat cv::face::BasicFaceRecognizer::_mean
| protected

## ◆ _num_components

int cv::face::BasicFaceRecognizer::_num_components
| protected

## ◆ _projections

std::vector<Mat> cv::face::BasicFaceRecognizer::_projections
| protected

## ◆ _threshold

double cv::face::BasicFaceRecognizer::_threshold
| protected

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

- opencv2/face/facerec.hpp