OpenCV for Unity 3.0.4
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/5.0/index.html ) for the details of the argument of the method.
Loading...
Searching...
No Matches
OpenCVForUnity.FaceModule.Facemark Class Reference

Abstract base class for all facemark models. More...

Public Member Functions

bool fit (Mat image, MatOfRect faces, List< MatOfPoint2f > landmarks)
 Detect facial landmarks from an image.
 
void loadModel (string model)
 A function to load the trained model before the fitting process.
 
- Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
virtual void clear ()
 Clears the algorithm state.
 
virtual bool empty ()
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.
 
virtual string getDefaultName ()
 
IntPtr getNativeObjAddr ()
 
void save (string filename)
 
- Public Member Functions inherited from OpenCVForUnity.DisposableObject
void Dispose ()
 Releases resources used by this object.
 
void ThrowIfDisposed ()
 Throws ObjectDisposedException if this object has been disposed.
 

Static Public Member Functions

static new Facemark __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
static Algorithm __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.DisposableObject
static IntPtr ThrowIfNullIntPtr (IntPtr ptr)
 Returns the native pointer, or throws CoreModule.CvException if it is zero.
 

Protected Member Functions

override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
- Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject
 DisposableOpenCVObject ()
 Initializes a new instance with a zero native pointer and dispose enabled.
 
 DisposableOpenCVObject (bool isEnabledDispose)
 Initializes a new instance with a zero native pointer.
 
 DisposableOpenCVObject (IntPtr ptr)
 Initializes a new instance with the specified native pointer and dispose enabled.
 
 DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose)
 Initializes a new instance with the specified native pointer.
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableObject
 DisposableObject ()
 Initializes a new instance with dispose enabled.
 
 DisposableObject (bool isEnabledDispose)
 Initializes a new instance.
 

Additional Inherited Members

- Package Functions inherited from OpenCVForUnity.CoreModule.Algorithm
- Package Attributes inherited from OpenCVForUnity.DisposableOpenCVObject
- Properties inherited from OpenCVForUnity.DisposableObject
bool IsDisposed [get, protected set]
 
bool IsEnabledDispose [get, set]
 

Detailed Description

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:

Member Function Documentation

◆ __fromPtr__()

static new Facemark OpenCVForUnity.FaceModule.Facemark.__fromPtr__ ( IntPtr addr)
static

◆ Dispose()

override void OpenCVForUnity.FaceModule.Facemark.Dispose ( bool disposing)
protectedvirtual

◆ fit()

bool OpenCVForUnity.FaceModule.Facemark.fit ( Mat image,
MatOfRect faces,
List< MatOfPoint2f > landmarks )

Detect facial landmarks from an image.

Parameters
imageInput image.
facesOutput of the function which represent region of interest of the detected faces. Each face is stored in cv::Rect container.
landmarksThe 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);
n-dimensional dense array class
Definition Mat_ValueTuple.cs:10

◆ loadModel()

void OpenCVForUnity.FaceModule.Facemark.loadModel ( string model)

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

Parameters
modelA string represent the filename of a trained model.

Example of usage

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

The documentation for this class was generated from the following file: