Face Landmark Data [F200]

Top  Previous  Next

Similar to face location detection, if you enable landmark detection (PXC[M]FaceConfiguration.landmarks.IsEnabled=true), you can use the QueryLandmarks function to retrieve any detected landmark points.

The supported landmark points are illustrated in Figure 17.

Figure 17: 78 Point Landmark Features

The number of supported landmark points may vary on different implementations. Do not hard-code a specific implementation in your application.

You can retrieve the detected landmark points in its entirety (via the QueryPoints function), in groups (via the QueryPointsByGroup function), or in individual point (via the QueryPoint function).

Example 46 shows the steps to retrieve the face landmark data.

C++ Example 46: Retrieve Face Landmark Data

// fdata is a PXCFaceData instance

pxcI32 nfaces=fdata->QueryNumberOfDetectedFaces();

for (pxcI32 i=0;i<nfaces;i++) {

   // Retrieve the face landmark data instance

   PXCFaceData::Face *face=fdata->QueryFaceByIndex(i);

   PXCFaceData::LandmarksData *ldata=fdata->QueryLandmarks();

 

   // allocate the array big enough to hold the landmark points.

   pxcI32 npoints=ldata->QueryNumPoints();

   PXCFaceData::LandmarkPoint *points=new PXCFaceData::LandmarkPoint[npoints];

 

   // get the landmark data

   ldata->QueryPoints(points, &npoints);

 

   // Clean up

   delete[] points;

}

C# Example 46: Retrieve Face Landmark Data

// fdata is a PXCMFaceData instance

Int32 nfaces=fdata.QueryNumberOfDetectedFaces();

for (Int32 i=0;i<nfaces;i++) {

   // Retrieve the face landmark data instance

   PXCMFaceData.Face face=fdata.QueryFaceByIndex(i);

   PXCMFaceData.LandmarksData ldata=fdata.QueryLandmarks();

 

   // get the landmark data

   PXCMFaceData.LandmarkPoint[] points;

   ldata.QueryPoints(out points);

}

Java Example 46: Retrieve Face Landmark Data

// fdata is a PXCMFaceData instance

int nfaces=fdata.QueryNumberOfDetectedFaces();

for (int i=0;i<nfaces;i++) {

   // Retrieve the face landmark data instance

   PXCMFaceData.Face face=fdata.QueryFaceByIndex(i);

   PXCMFaceData.LandmarksData ldata=fdata.QueryLandmarks();

 

   // allocate the array big enough to hold the landmark points.

   int npoints=ldata.QueryNumPoints();

   PXCMFaceData.LandmarkPoint[] points=new PXCMFaceData.LandmarkPoint[npoints];

 

   // get the landmark data

   ldata.QueryPoints(points);

}