opencv::prelude

Trait FacemarkKazemiTrait

Source
pub trait FacemarkKazemiTrait: FacemarkKazemiTraitConst + FacemarkTrait {
    // Required method
    fn as_raw_mut_FacemarkKazemi(&mut self) -> *mut c_void;

    // Provided methods
    fn training(
        &mut self,
        images: &mut Vector<Mat>,
        landmarks: &mut Vector<Vector<Point2f>>,
        configfile: &str,
        scale: Size,
        model_filename: &str,
    ) -> Result<bool> { ... }
    fn training_def(
        &mut self,
        images: &mut Vector<Mat>,
        landmarks: &mut Vector<Vector<Point2f>>,
        configfile: &str,
        scale: Size,
    ) -> Result<bool> { ... }
    fn set_face_detector(
        &mut self,
        f: Option<Box<dyn FnMut(*const c_void, *const c_void) -> bool + Send + Sync + 'static>>,
    ) -> Result<bool> { ... }
    fn get_faces(
        &mut self,
        image: &impl ToInputArray,
        faces: &mut impl ToOutputArray,
    ) -> Result<bool> { ... }
}
Expand description

Mutable methods for crate::face::FacemarkKazemi

Required Methods§

Provided Methods§

Source

fn training( &mut self, images: &mut Vector<Mat>, landmarks: &mut Vector<Vector<Point2f>>, configfile: &str, scale: Size, model_filename: &str, ) -> Result<bool>

This function is used to train the model using gradient boosting to get a cascade of regressors which can then be used to predict shape.

§Parameters
  • images: A vector of type cv::Mat which stores the images which are used in training samples.
  • landmarks: A vector of vectors of type cv::Point2f which stores the landmarks detected in a particular image.
  • scale: A size of type cv::Size to which all images and landmarks have to be scaled to.
  • configfile: A variable of type std::string which stores the name of the file storing parameters for training the model.
  • modelFilename: A variable of type std::string which stores the name of the trained model file that has to be saved.
§Returns

A boolean value. The function returns true if the model is trained properly or false if it is not trained.

§C++ default parameters
  • model_filename: “face_landmarks.dat”
Source

fn training_def( &mut self, images: &mut Vector<Mat>, landmarks: &mut Vector<Vector<Point2f>>, configfile: &str, scale: Size, ) -> Result<bool>

This function is used to train the model using gradient boosting to get a cascade of regressors which can then be used to predict shape.

§Parameters
  • images: A vector of type cv::Mat which stores the images which are used in training samples.
  • landmarks: A vector of vectors of type cv::Point2f which stores the landmarks detected in a particular image.
  • scale: A size of type cv::Size to which all images and landmarks have to be scaled to.
  • configfile: A variable of type std::string which stores the name of the file storing parameters for training the model.
  • modelFilename: A variable of type std::string which stores the name of the trained model file that has to be saved.
§Returns

A boolean value. The function returns true if the model is trained properly or false if it is not trained.

§Note

This alternative version of FacemarkKazemiTrait::training function uses the following default values for its arguments:

  • model_filename: “face_landmarks.dat”
Source

fn set_face_detector( &mut self, f: Option<Box<dyn FnMut(*const c_void, *const c_void) -> bool + Send + Sync + 'static>>, ) -> Result<bool>

set the custom face detector

Source

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

get faces using the custom detector

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§