Luxand FaceSDK – Facial Feature Detection

FaceSDK provides the FSDK_DetectFacialFeatures function to detect facial features in an image and the FSDK_DetectEyes function to detect just eye centers in an image. First, these functions detect a frontal face in an image, and then detect its facial features or only eye centers. The FSDK_DetectFacialFeaturesInRegion and FSDK_DetectEyesInRegion functions do not perform the face detection step and detect facial features or eye centers in a region returned by FSDK_DetectFace or FSDK_DetectMultipleFaces.

In the current version of Luxand FaceSDK the performance of FSDK_DetectEyes and FSDK_DetectFacialFeatures is the same, so there is no advantage in calling FSDK_DetectEyes instead of FSDK_DetectFacialFeatures.

The facial features are stored in the FSDK_Features data structure. FSDK_Features is an array data type containing FSDK_FACIAL_FEATURE_COUNT points. The list of facial features recognized by FaceSDK is available in the Detected Facial Features chapter.

Eye centers are saved to FSDK_Features[0] and FSDK_Features[1]. The FSDK_DetectEyes and FSDK_DetectEyesInRegion functions do not change other elements of the FSDK_Features array.

C++ Declaration:

typedef struct { int x,y; } TPoint;
typedef TPoint FSDK_Features [FSDK_FACIAL_FEATURE_COUNT];

 C# Declaration:

public struct TPoint {
   public int x, y;
}

Delphi Declaration:

TPoint = record
   x, y: integer;
end;
FSDK_Features = array[0..FSDK_FACIAL_FEATURE_COUNT - 1] of TPoint;
PFSDK_Features = ^FSDK_Features;

VB Declaration:

Type TPoint
   x As Long
   y As Long
End Type

Java and Android Declaration:

The class TPoint has the following properties:

   public int x, y;

The class FSDK_Features has the following property:

   public TPoint features[];

  FSDK_DetectFacialFeatures Function

Detects a frontal face in an image and detects its facial features.

C++ Syntax:

int FSDK_DetectFacialFeatures(HImage Image, FSDK_Features* FacialFeatures);

Delphi Syntax:

function FSDK_DetectFacialFeatures(Image: HImage; FacialFeatures: PFSDK_Features): integer;

C# Syntax:

int FSDK.DetectFacialFeatures(int Image, out FSDK.TPoint[] FacialFeatures);

VB Syntax:

Function FSDKVB_DetectFacialFeatures(ByVal Image As Long, ByRef FacialFeatures As TPoint) As Long

Java Syntax:

int FSDK.DetectFacialFeatures(HImage Image, FSDK_Features.ByReference FacialFeatures);

Android Syntax:

int FSDK.DetectFacialFeatures(HImage Image, FSDK_Features FacialFeatures);

CImage Syntax:

FSDK.TPoint[] FSDK.CImage.DetectFacialFeatures();

Parameters:

Image - handle of the image facial features should be detected in.

FacialFeatures – pointer to the FSDK_Features array for receiving the detected facial features.

Return Value:

Returns FSDKE_OK if successful.

Example

int img1;
FSDK_Features Features;

FSDK_Initialize("");
FSDK_LoadImageFromFile(&img1, "test.jpg");
FSDK_DetectFacialFeatures(img1, Features);

printf("Left eye location: (%d, %d)\n", Features[FSDKP_LEFT_EYE].x, Features[FSDKP_LEFT_EYE].y);
printf("Right eye location: (%d, %d)\n", Features[FSDKP_RIGHT_EYE].y, Features[FSDKP_RIGHT_EYE].y);

  FSDK_DetectFacialFeaturesInRegion Function

Detects facial features in an image region returned by FSDK_DetectFace or FSDK_DetectMultipleFaces. This function can be useful if an approximate face size is known, or to detect facial features of a specific face returned by FSDK_DetectMultipleFaces.

C++ Syntax:

int FSDK_DetectFacialFeaturesInRegion(HImage Image, TFacePosition* FacePosition, FSDK_Features* FacialFeatures);

Delphi Syntax:

function FSDK_DetectFacialFeaturesInRegion(Image: HImage; FacePosition: PFacePosition; FacialFeatures: PFSDK_Features): integer;

C# Syntax:

int FSDK.DetectFacialFeaturesInRegion(int Image, ref FSDK.TFacePosition FacePosition, out FSDK.TPoint[] FacialFeatures);

VB Syntax:

Function FSDKVB_DetectFacialFeaturesInRegion(ByVal Image As Long, ByRef FacePosition As TFacePosition, ByRef FacialFeatures As TPoint) As Long

Java Syntax:

int FSDK.DetectFacialFeaturesInRegion(HImage Image, TFacePosition FacePosition, FSDK_Features.ByReference FacialFeatures);

Android Syntax:

int FSDK.DetectFacialFeaturesInRegion(HImage Image, TFacePosition FacePosition, FSDK_Features FacialFeatures);

CImage Syntax:

FSDK.TPoint[] FSDK.CImage.DetectFacialFeaturesInRegion(ref FSDK.TFacePosition FacePosition);

Parameters:

Image– handle of the image facial features should be detected in.

FacePosition– pointer to the face position structure.

FacialFeatures– pointer to the FSDK_Features array for receiving the detected facial features.

Return Value:

Returns FSDKE_OK if successful.

Example

int i, DetectedCount, img1;
FSDK_Features Features;
TFacePosition FaceArray[50];

FSDK_Initialize("");
FSDK_LoadImageFromFile(&img1, "test.jpg");

FSDK_DetectMultipleFaces(img1, &DetectedCount , FaceArray, sizeof(FaceArray));

for (i = 0; i < DetectedCount; i++) {
   FSDK_DetectFacialFeaturesInRegion(img1, FaceArray[i], Features);
   printf("Left eye location: (%d, %d)\n", Features[FSDKP_LEFT_EYE].x, Features[FSDKP_LEFT_EYE].y);
   printf("Right eye location: (%d, %d)\n", Features[FSDKP_RIGHT_EYE].x, Features[FSDKP_RIGHT_EYE].y);
}

  FSDK_DetectEyes Function

Detects a frontal face in an image and detects its eye centers.

C++ Syntax:

int FSDK_DetectEyes(HImage Image, FSDK_Features* FacialFeatures);

Delphi Syntax:

function FSDK_DetectEyes(Image: HImage; FacialFeatures: PFSDK_Features): integer;

C# Syntax:

int FSDK.DetectEyes(int Image, out FSDK.TPoint[] FacialFeatures);

VB Syntax:

Function FSDKVB_DetectEyes (ByVal Image As Long, ByRef FacialFeatures As TPoint) As Long

Java Syntax:

int FSDK.DetectEyes(HImage Image, FSDK_Features.ByReference FacialFeatures);

Android Syntax:

int FSDK.DetectEyes(HImage Image, FSDK_Features FacialFeatures);

CImage Syntax:

FSDK.TPoint[] FSDK.CImage.DetectEyes();

Parameters:

Image– handle of the image eye centers should be detected in.

FacialFeatures– pointer to the FSDK_Features array for receiving the detected eye centers.

Return Value:

Returns FSDKE_OK if successful.

  FSDK_DetectEyesInRegion Function

Detects eye centers in an image region returned by FSDK_DetectFace or FSDK_DetectMultipleFaces.

C++ Syntax:

int FSDK_DetectEyesInRegion(HImage Image, TFacePosition* FacePosition, FSDK_Features* FacialFeatures);

Delphi Syntax:

function FSDK_DetectEyesInRegion(Image: HImage; FacePosition: PFacePosition; FacialFeatures: PFSDK_Features): integer;

C# Syntax:

int FSDK.DetectEyesInRegion(int Image, ref FSDK.TFacePosition FacePosition, out FSDK.TPoint[] FacialFeatures);

VB Syntax:

Function FSDKVB_DetectEyesInRegion(ByVal Image As Long, ByRef FacePosition As TFacePosition, ByRef FacialFeatures As TPoint) As Long

Java Syntax:

int FSDK.DetectEyesInRegion(HImage Image, TFacePosition FacePosition, FSDK_Features.ByReference FacialFeatures);

Android Syntax:

int FSDK.DetectEyesInRegion(HImage Image, TFacePosition FacePosition, FSDK_Features FacialFeatures);

CImage Syntax:

FSDK.TPoint[] FSDK.CImage.DetectEyesInRegion(ref FSDK.TFacePosition FacePosition);

Parameters:

Image – handle of the image eye centers should be detected in.

FacePosition – pointer to the face position structure.

FacialFeatures – pointer to the FSDK_Features array for receiving the detected eye centers.

Return Value:

Returns FSDKE_OK if successful.

 

Next chapterDetected Facial Features

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