Class cv::face::Facemark#

Abstract base class for all facemark models. View details

Collaboration diagram for cv::face::Facemark:

Public Member Functions#

Public Member Functions inherited from cv::Algorithm

Return

Name

Description

Algorithm()

~Algorithm()

void

clear()

Clears the algorithm state.

bool

empty()

Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.

String

getDefaultName()

void

read(const FileNode & fn)

Reads algorithm parameters from a file storage.

void

save(const String & filename)

void

write(
    const Ptr< FileStorage > & fs,
    const String & name = String() )

void

write(FileStorage & fs)

Stores algorithm parameters in a file storage.

void

write(
    FileStorage & fs,
    const String & name )

Static Public Member Functions#

Static Public Member Functions inherited from cv::Algorithm

Return

Name

Description

static Ptr< _Tp >

load(
    const String & filename,
    const String & objname = String() )

Loads algorithm from the file.

static Ptr< _Tp >

loadFromString(
    const String & strModel,
    const String & objname = String() )

Loads algorithm from a String.

static Ptr< _Tp >

read(const FileNode & fn)

Reads algorithm from the file node.

Additional Inherited Members#

Protected Member Functions inherited from cv::Algorithm

Return

Name

Description

void

writeFormat(FileStorage & fs)

Detailed Description#

class Facemark : public virtual cv::Algorithm#

Abstract base class for all facemark models.

To utilize this API in your program, please take a look at the tutorial_table_of_content_facemark

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:

  • Load the trained model using Facemark::loadModel.

  • Perform the fitting on an image via Facemark::fit.

Subclassed by cv::face::FacemarkKazemi, cv::face::FacemarkTrain

Member Function Documentation#

fit()#

bool cv::face::Facemark::fit(
InputArray image,
InputArray faces,
OutputArrayOfArrays landmarks )

Detect facial landmarks from an image.

Example of usage

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

Parameters

  • image — Input image.

  • faces — Output of the function which represent region of interest of the detected faces. Each face is stored in cv::Rect container.

  • landmarks — The detected landmark points for each faces.

loadModel()#

void cv::face::Facemark::loadModel(String model)

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

Example of usage

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

Parameters

  • model — A string represent the filename of a trained model.

Source file#

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