Luxand FaceCrop SDK – Face Detection and Cropping Parameters

You can use the fcCropFace and fcGetFacePosition functions to detect and crop a frontal face. The performance and reliability of face detection is controlled by the fcSetDetectionPerfomance, fcSetDetectionThreshold. Parameters of the cropped face are controlled by the fcSetFaceScale and fcSetFaceShift functions.

Three levels of face detection performance are stored in the FcDetectionPerformance type.

C++ Declaration:

typedef enum {

fcPerformanceRealtime = 0,

fcPerformanceNormal,

fcPerformancePrecise

} FcDetectionPerformance;

The fcPerformanceRealtime value detects only those faces that take a considerable part of the photo, whose rotation angle (in the picture plane) lies within the range from -15 degrees to +15 degrees. This value should be used if faces need to be detected in real time.

The fcPerformanceNormal value detects small faces, whose rotation angle (in the picture plane) lies within the range from -30 degrees to +30 degrees. This is the default value and suitable for the majority of applications.

The fcPerformancePrecise value detects even the smallest faces, whose rotation angle (in the picture plane) lies within the range from -30 degrees to +30 degrees. This value should be used if it is necessary to detect a face on a large photo and position the face in the returned rectangle as accurately as possible. Please note that it takes more time to detect a face when fcPerformancePrecise is used.

Face detection performance is determined by the fcSetDetectionPerformance function.

fcSetDetectionPerfomance Function

Sets the level of detection performance. The default value is fcPerformanceNormal.

C++ Syntax:

int fcSetDetectionPerformance(FcDetectionPerformance level);

Delphi Syntax:

function fcSetDetectionPerformance(level: FcDetectionPerformance): integer;

C# Syntax:

int fc.SetDetectionPerformance(fc.FcDetectionPerformance level);

PHP Syntax:

int fcSetDetectionPerformance(int $level, int $ContextID);

VB Syntax:

Function fcVBSetDetectionPerformance(ByVal level As FcDetectionPerformance) As Long

Parameters:

level – level of face detection performance.

Return Value:

Returns fcErrorOk if successful.

fcSetDetectionThreshold Function

Sets a threshold value for face detection. The default value is 3.

The function allows adjusting the sensitivity of detection. If the threshold value is set to a higher value, the detector will only recognize faces with sharp, clearly defined details, thus reducing the number of false positive detections. Setting the threshold lower allows detecting more faces with less clearly defined features at the expense of increased number of false positives.

C++ Syntax:

int fcSetDetectionThreshold(int Threshold);

Delphi Syntax:

function fcSetDetectionThreshold(Threshold: integer): integer;

C# Syntax:

int fc.SetDetectionThreshold(int Threshold);

PHP Syntax:

int fcSetDetectionThreshold(int $Threshold, int $ContextID);

VB Syntax:

Function fcVBSetDetectionThreshold(ByVal threshold As Long) As Long

Parameters:

Threshold– threshold value.

Return Value:

Returns fcErrorOk if successful.

fcSetFaceScale Function

Sets face scaling rate for cropping. The higher the value, the larger part of the resulting rectangle is taken by the face. The lower the value, the larger part of the resulting rectangle is taken by background. The default value is 1.

C++ Syntax:

int fcSetFaceScale(float scale);

Delphi Syntax:

function fcSetFaceScale(scale: single): integer;

C# Syntax:

int fc.SetFaceScale(float scale);

PHP Syntax:

int fcSetFaceScale(float $scale, int $ContextID);

VB Syntax:

Function fcVBSetFaceScale(ByVal faceScale As Single) As Long

Parameters:

scale– scale value. It must be higher than 0.

Return Value:

Returns fcErrorOk if successful.

fcSetFaceShift Function

Sets off-centering rate for the cropped face. Parameter values are set approximately within the face width (for example, if you select 0.5, the face will be shifted from the center approximately by half of its width). By default, both parameters are equal to 0.

C++ Syntax:

int fcSetFaceShift(float ShiftX, float ShiftY);

Delphi Syntax:

function fcSetFaceShift(ShiftX: single; ScaleY: single): integer;

C# Syntax:

int fc.SetFaceShift(float ShiftX, float ShiftY);

PHP Syntax:

int fcSetFaceShift(float $ShiftX, float $ShiftY, int $ContextID);

VB Syntax:

Function fcVBSetFaceShift(ByVal shiftX As Single, ByVal shiftY As Single) As Long

Parameters:

ShiftX– horizontal shift value. It is set as fraction of the width of the cropped rectangle.

ShiftY– vertical shift value. It is set as fraction of the height of the cropped rectangle.

Return Value:

Returns fcErrorOk if successful.

 

Next chapterSupport Functions

Contents

Get in touch

Luxand, Inc.
815 N. Royal St. Suite 202
Alexandria, VA
22314
USA
Freephone:
+1 800 471 5636

Join our newsletter

And always stay informed of the latest company news and events!

Sign up >>

DMCA.com Protection Status