[][src]Trait opencv::face::prelude::Facemark

pub trait Facemark: AlgorithmTrait {
    pub fn as_raw_Facemark(&self) -> *const c_void;
pub fn as_raw_mut_Facemark(&mut self) -> *mut c_void; pub fn load_model(&mut self, model: &str) -> Result<()> { ... }
pub fn fit(
        &mut self,
        image: &dyn ToInputArray,
        faces: &dyn ToInputArray,
        landmarks: &mut dyn ToOutputArray
    ) -> Result<bool> { ... } }

Abstract base class for all facemark models

To utilize this API in your program, please take a look at the @ref 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.

Required methods

Loading content...

Provided methods

pub fn load_model(&mut self, model: &str) -> Result<()>[src]

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

Parameters

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

Example of usage

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

pub fn fit(
    &mut self,
    image: &dyn ToInputArray,
    faces: &dyn ToInputArray,
    landmarks: &mut dyn ToOutputArray
) -> Result<bool>
[src]

Detect facial landmarks from an image.

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.

Example of usage

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

Implementors

Loading content...