Skip to content

face_Facemark

faceclassOpenCV 5.0.0
import { face_Facemark } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSConstructor or factory
CLASSface_Facemark
RETURN TYPEOwned native handle
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Native object: release it with using or delete(). Factories can return null; check before calling methods. Inherits 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.

Constructors and members

clone

Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.

clone(): this;
Returns

The this result.

loadModel

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

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

A string represent the filename of a trained model.

<B>Example of usage</B>

fit

virtual void saveModel(String fs)=0; Detect facial landmarks from an image.

    Mat image = imread("image.jpg");
    std::vector<Rect> faces;
    std::vector<std::vector<Point2f> > landmarks;
    facemark->fit(image, faces, landmarks);
    
fit(image: Mat, faces: Mat, landmarks: MatVector): boolean;
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

Output destination, filled by the native operation. The detected landmark points for each faces.

<B>Example of usage</B>

Returns

The boolean result.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.