face_Facemark
import { face_Facemark } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
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;The this result.
loadModel
A function to load the trained model before the fitting process.
facemark->loadModel("../data/lbf.model");
loadModel(model: EmbindString): void;modelA 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;imageInput image.
facesOutput of the function which represent region of interest of the detected faces. Each face is stored in cv::Rect container.
landmarksOutput destination, filled by the native operation. The detected landmark points for each faces.
<B>Example of usage</B>
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.