Skip to content

face_FacemarkTrain

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

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

ARGUMENTSConstructor or factory
CLASSface_FacemarkTrain
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 face_Facemark.

Abstract base class for trainable facemark models

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

Description

The AAM and LBF facemark models in OpenCV are derived from the abstract base class FacemarkTrain, which provides a unified access to those facemark algorithms in OpenCV.

Here is an example on how to declare facemark algorithm:

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

The typical pipeline for facemark detection is listed as follows:

  • (Non-mandatory) Set a user defined face detection using FacemarkTrain::setFaceDetector. The facemark algorithms are designed to fit the facial points into a face. Therefore, the face information should be provided to the facemark algorithm. Some algorithms might provides a default face recognition function. However, the users might prefer to use their own face detector to obtains the best possible detection result.
  • (Non-mandatory) Training the model for a specific algorithm using FacemarkTrain::training. In this case, the model should be automatically saved by the algorithm. If the user already have a trained model, then this part can be omitted.
  • Load the trained model using Facemark::loadModel.
  • Perform the fitting via the 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.

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.