OpenCV  5.0.0alpha
Open Source Computer Vision
Loading...
Searching...
No Matches
cv::face::Facemark Class Referenceabstract

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

#include <opencv2/face/facemark.hpp>

Collaboration diagram for cv::face::Facemark:

Public Member Functions

virtual bool fit (InputArray image, InputArray faces, OutputArrayOfArrays landmarks)=0
 Detect facial landmarks from an image.
 
virtual void loadModel (String model)=0
 A function to load the trained model before the fitting process.
 
- Public Member Functions inherited from cv::Algorithm
 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
 
virtual void write (FileStorage &fs) const
 Stores algorithm parameters in a file storage.
 
void write (FileStorage &fs, const String &name) const
 

Additional Inherited Members

- Static Public Member Functions inherited from cv::Algorithm
template<typename _Tp >
static Ptr< _Tpload (const String &filename, const String &objname=String())
 Loads algorithm from the file.
 
template<typename _Tp >
static Ptr< _TploadFromString (const String &strModel, const String &objname=String())
 Loads algorithm from a String.
 
template<typename _Tp >
static Ptr< _Tpread (const FileNode &fn)
 Reads algorithm from the file node.
 
- 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:
std::shared_ptr< _Tp > Ptr
Definition cvstd_wrapper.hpp:23
Ptr< Facemark > createFacemarkLBF()
construct an LBF facemark detector

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:
cv.face.Facemark.fit(image, faces[, landmarks]) -> retval, 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);
n-dimensional dense array class
Definition mat.hpp:951
CV_EXPORTS_W Mat imread(const String &filename, int flags=IMREAD_COLOR_BGR)
Loads an image from a file.

◆ loadModel()

virtual void cv::face::Facemark::loadModel ( String model)
pure virtual
Python:
cv.face.Facemark.loadModel(model) -> None

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: