Luxand MirrorReality SDK – MirrorReality SDK Functions

The facial feature coordinates of the mask are stored in the MR_MaskFeatures data structure. MR_MaskFeatures is an array data type containing FSDK_FACIAL_FEATURE_COUNT points.

iOS, Objective-C Declaration:

typedef struct {
   float x, y;
} TPointf;

typedef TPointf MR_MaskFeatures [FSDK_FACIAL_FEATURE_COUNT];

Android, Java Declaration:

The class TPointf has the following properties:

   public float x, y;

The class MR_MaskFeatures has the following property:

   public TPointf features[];

C++ Declaration:

typedef struct {
    float x, y;
} TPointf;

typedef TPointf MR_MaskFeatures [FSDK_FACIAL_FEATURE_COUNT];

 

  MR_LoadMaskCoordsFromFile Function

Loads facial feature coordinates of the mask from .grd file.

iOS, Objective-C Syntax:

int MR_LoadMaskCoordsFromFile (const char * filename, MR_MaskFeatures maskCoords);

C++ Syntax:

int MR_LoadMaskCoordsFromFile (const char * filename, MR_MaskFeatures maskCoords);

Parameters:

filename – pointer to the null-terminated string containing the name of a .grd file from which the mask coordinates will be loaded.

maskCoords – pointer to the array containing mask facial feature coordinates.

Return Value:

Returns FSDKE_OK if successful.

 

  MR_LoadMaskCoordsFromStream Function

Loads facial feature coordinates of the mask from a stream.

Android, Java Syntax:

int MR.LoadMaskCoordsFromStream (InputStream stream, MaskFeatures maskCoords);

Parameters:

stream – pointer to InputStream opened for .grd file's resource.

maskCoords – pointer to the array containing mask facial feature coordinates.

Return Value:

Returns FSDKE_OK if successful.

 

  MR_LoadMask Function

Loads mask layers from files and loads them into OpenGL Textures.

iOS, Objective-C Syntax:

int MR_LoadMask (HImage maskImage1, HImage maskImage2, GLuint maskTexture1, GLuint maskTexture2, int * isTexture1Created, int * isTexture2Created);

Android, Java Syntax:

int MR.LoadMask (HImage maskImage1, HImage maskImage2, GLuint maskTexture1, GLuint maskTexture2, int * isTexture1Created, int * isTexture2Created);

C++ Syntax:

int MR_LoadMask (HImage maskImage1, HImage maskImage2, GLuint maskTexture1, GLuint maskTexture2, int * isTexture1Created, int * isTexture2Created);

Parameters:

maskImage1 – handle of the mask layer that is applied in multiply mode.

maskImage2 – handle of the mask layer that is applied in normal mode.

maskTexture1 – OpenGL texture of mask layer that is applied in multiply mode.

maskTexture2 – OpenGL texture of mask layer that is applied in normal mode.

isTexture1Created – flag indicating if the layer that is applied in multiply mode is copied to the OpenGL texture. The flag is equal to 0 if maskImage1 is empty, and is equal to 1 if maskImage1 is not empty.

isTexture2Created – flag indicating if the layer that is applied in normal mode is copied to the OpenGL texture. The flag is equal to 0 if maskImage2 is empty, and is equal to 1 if maskImage2 is not empty.

Return Value:

Returns FSDKE_OK if successful.

 

  MR_DrawGLScene Function

Draws the faces with the masks on the screen.

iOS, Objective-C Syntax:

int MR_DrawGLScene (GLuint facesTexture, int facesDetected, FSDK_Features features[MR_MAX_FACES], int rotationAngle90Multiplier, int shiftType, GLuint maskTexture1, GLuint maskTexture2, MR_MaskFeatures maskCoords, int isTexture1Created, int isTexture2Created, int width, int height);

Android, Java Syntax:

int MR.DrawGLScene (GLuint facesTexture, int facesDetected, FSDK_Features features[MR_MAX_FACES], int rotationAngle90Multiplier, int shiftType, GLuint maskTexture1, GLuint maskTexture2, MR_MaskFeatures maskCoords, int isTexture1Created, int isTexture2Created, int width, int height);

C++ Syntax:

int MR_DrawGLScene (GLuint facesTexture, int facesDetected, FSDK_Features features[MR_MAX_FACES], int rotationAngle90Multiplier, int shiftType, GLuint maskTexture1, GLuint maskTexture2, MR_MaskFeatures maskCoords, int isTexture1Created, int isTexture2Created, int width, int height);

Parameters:

facesTexture – OpenGL texture containing original frame from the camera.

facesDetected – number of detected faces that FSDK_FeedFrame returns.

features – arrays of facial features that FSDK_GetTrackerFacialFeatures returns.

rotationAngle90Multiplier – rotation angle (iOS: -1 for portrait, 1 for portrait upside down, 0 for landscape right, and 2 for landscape left).

shiftType – shift of facial feature coordinates (0 if coordinates are not shifted, 1 if the face should be shorter after transformation, 2 if the face should be longer after transformation).

maskTexture1 – OpenGL texture of mask layer that is applied in multiply mode.

maskTexture2 – OpenGL texture of mask layer that is applied in normal mode.

maskCoords – pointer to the array containing mask facial feature coordinates.

isTexture1Created – flag indicating if the layer that is applied in multiply mode is copied to the OpenGL texture.

isTexture2Created – flag indicating if the layer that is applied in normal mode is copied to the OpenGL texture.

width – width of the output frame.

height – height of the output frame.

Return Value:

Returns FSDKE_OK if successful.

 

Next chapterLibrary Information

Contents