opencv::face

Trait FacemarkTrait

Source
pub trait FacemarkTrait: AlgorithmTrait + FacemarkTraitConst {
    // Required method
    fn as_raw_mut_Facemark(&mut self) -> *mut c_void;

    // Provided methods
    fn load_model(&mut self, model: &str) -> Result<()> { ... }
    fn fit(
        &mut self,
        image: &impl ToInputArray,
        faces: &impl ToInputArray,
        landmarks: &mut impl ToOutputArray,
    ) -> Result<bool> { ... }
}
Expand description

Mutable methods for crate::face::Facemark

Required Methods§

Provided Methods§

Source

fn load_model(&mut self, model: &str) -> Result<()>

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");
Source

fn fit( &mut self, image: &impl ToInputArray, faces: &impl ToInputArray, landmarks: &mut impl ToOutputArray, ) -> Result<bool>

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);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§