@Namespace(value="cv::face") @Properties(inherit=opencv_face.class) public class Facemark extends Algorithm
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.
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
Facemark(Pointer p)
Pointer cast constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
fit(Mat image,
RectVector faces,
Point2fVectorVector landmarks)
\brief Detect facial landmarks from an image.
|
void |
loadModel(BytePointer model)
\brief A function to load the trained model before the fitting process.
|
void |
loadModel(String model) |
clear, empty, getDefaultName, position, read, save, save, write, write, write
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, hashCode, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, toString, totalBytes, totalPhysicalBytes, withDeallocator, zero
public Facemark(Pointer p)
Pointer.Pointer(Pointer)
.public void loadModel(@opencv_core.Str BytePointer model)
model
- A string represent the filename of a trained model.
Example of usage
facemark->loadModel("../data/lbf.model");
public void loadModel(@opencv_core.Str String model)
@Cast(value="bool") public boolean fit(@ByVal Mat image, @ByRef RectVector faces, @ByRef Point2fVectorVector landmarks)
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);
Copyright © 2020. All rights reserved.