OpenCV  4.1.2-dev
Open Source Computer Vision
Public Member Functions | List of all members
cv::face::Facemark Class Referenceabstract

Abstract base class for all facemark models. More...

#include <opencv2/face/facemark.hpp>

Inheritance diagram for cv::face::Facemark:
cv::Algorithm cv::face::FacemarkKazemi cv::face::FacemarkTrain cv::face::FacemarkAAM cv::face::FacemarkLBF

Public Member Functions

virtual bool fit (InputArray image, InputArray faces, OutputArrayOfArrays landmarks)=0
 Detect facial landmarks from an image. More...
 
virtual void loadModel (String model)=0
 A function to load the trained model before the fitting process. More...
 
- Public Member Functions inherited from cv::Algorithm
 Algorithm ()
 
virtual ~Algorithm ()
 
virtual void clear ()
 Clears the algorithm state. More...
 
virtual bool empty () const
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. More...
 
virtual String getDefaultName () const
 
virtual void read (const FileNode &fn)
 Reads algorithm parameters from a file storage. More...
 
virtual void save (const String &filename) const
 
virtual void write (FileStorage &fs) const
 Stores algorithm parameters in a file storage. More...
 
void write (const Ptr< FileStorage > &fs, const String &name=String()) const
 simplified API for language bindings This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 

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. More...
 
template<typename _Tp >
static Ptr< _Tp > loadFromString (const String &strModel, const String &objname=String())
 Loads algorithm from a String. More...
 
template<typename _Tp >
static Ptr< _Tp > read (const FileNode &fn)
 Reads algorithm from the file node. More...
 
- Protected Member Functions inherited from cv::Algorithm
void writeFormat (FileStorage &fs) const
 

Detailed Description

Abstract base class for all facemark models.

To utilize this API in your program, please take a look at the Tutorial on Facial Landmark Detector API

Description

Facemark is a base class which provides universal access to any specific facemark algorithm. Therefore, the users should declare a desired algorithm before they can use it in their application.

Here is an example on how to declare a facemark algorithm:

// Using Facemark in your code:
Ptr<Facemark> facemark = createFacemarkLBF();

The typical pipeline for facemark detection is as follows:

Member Function Documentation

◆ fit()

virtual bool cv::face::Facemark::fit ( InputArray  image,
InputArray  faces,
OutputArrayOfArrays  landmarks 
)
pure virtual
Python:
retval, landmarks=cv.face_Facemark.fit(image, faces[, landmarks])

Detect facial landmarks from an image.

Parameters
imageInput image.
facesOutput of the function which represent region of interest of the detected faces. Each face is stored in cv::Rect container.
landmarksThe detected landmark points for each faces.

Example of usage

Mat image = imread("image.jpg");
std::vector<Rect> faces;
std::vector<std::vector<Point2f> > landmarks;
facemark->fit(image, faces, landmarks);

◆ loadModel()

virtual void cv::face::Facemark::loadModel ( String  model)
pure virtual
Python:
None=cv.face_Facemark.loadModel(model)

A function to load the trained model before the fitting process.

Parameters
modelA string represent the filename of a trained model.

Example of usage

facemark->loadModel("../data/lbf.model");

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