visageSDK

Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
VisageSDK::FDP Class Reference

Feature points of a face. More...

`#include <FDP.h>`

## Public Member Functions
| FDP ()
| Constructor. More...
| FDP (const FDP &featurePoints)
| Copy constructor. More...
| FDP (const char *fn)
| Constructor. More...
int | readFromFile (const char *name)
| Read from an FDP file. More...
void | createNewFile (const char *name)
| Create a new (empty) FDP file. More...
void | saveToFile () const
| Write feature point definitions to the current FDP file. More...
void | saveToFile (const char *fileName)
| Write feature point definitions to the FDP file, changing the FDP file name. More...
const FeaturePoint & | getFP (int group, int n) const
| Get a feature point by its group and index. More...
const FeaturePoint & | getFP (const char *name) const
| Get a feature point by its name. More...
void | setFP (int group, int n, const FeaturePoint &f)
| Set a feature specified by its group and index. More...
void | setFP (const char *name, const FeaturePoint &f)
| Set a feature specified by its name. More...
const float * | getFPPos (int group, int n) const
| Get the position of a feature point specified by its group and index. More...
const float * | getFPPos (const char *name) const
| Get the position of a feature point specified by its name. More...
float | getFPQuality (int group, int n) const
| Get the quality of a feature point specified by its group and index. More...
float | getFPQuality (const char *name) const
| Get the quality of a feature point specified by its name. More...
void | setFPQuality (int group, int n, const float quality)
| Set the quality of a feature point specified by its group and index. More...
void | setFPQuality (const char *name, const float quality)
| Set the position of a feature point specified by its name. More...
void | setFPPos (int group, int n, const float *pos)
| Set the position of a feature point specified by its group and index. More...
void | setFPPos (const char *name, const float *pos)
| Set the position of a feature point specified by its name. More...
void | setFPPos (int group, int n, float x, float y, float z)
| Set the position of a feature point specified by its group and index. More...
void | setFPPos (const char *name, float x, float y, float z)
| Set the position of a feature point specified by its name. More...
bool | getFPSurfVert (int group, int n, std::string &surf, int &vert) const
| Get the mesh and vertex mapping for a feature point specified by its group and index. More...
bool | getFPSurfVert (const char *name, std::string &surf, int &vert) const
| Get the mesh and vertex mapping for a feature point specified by its name. More...
void | setFPSurfVert (int group, int n, const std::string &surf, int vert)
| Assign a feature point, specified by its group and index, to a specific vertex. More...
void | setFPSurfVert (const char *name, const std::string &surf, int vert)
| Assign a feature point, specified by its name, to a specific vertex. More...
void | reset ()
| Resets all feature points. More...
bool | FPIsDefined (int group, int n) const
| Returns true if the feature point is defined. More...
bool | FPIsDefined (const std::string &name) const
| Returns true if the feature point is defined. More...
bool | FPIsDetected (int group, int n) const
| Returns true if the feature point is detected. More...
bool | FPIsDetected (const std::string &name) const
| Returns true if the feature point is detected. More...

## Static Public Member Functions
static void | parseFPName (const std::string &name, int &group, int &n)
| Get feature point group and index from its name. More...
static std::string | getFPName (int group, int n)
| Get feature point name from group and index. More...
static bool | FPIsValid (int group, int n)
| Returns true if specified feature point identifier is valid. More...
static bool | FPIsValid (const std::string &name)
| Returns true if specified feature point identifier is valid. More...
static int | groupSize (int group)
| Get the size of the specified feature point group. More...
static int | getMirrorPointIndex (int group, int index)
| Get the mirror point index for the point defined by given group and index. More...

## Static Public Attributes
static const int | FP_START_GROUP_INDEX = 2
| Index of the first feature point group. More...
static const int | FP_END_GROUP_INDEX = 17
| Index of the last feature point group. More...
static const int | FP_NUMBER_OF_GROUPS = 16
| Number of groups.

## Detailed Description

Feature points of a face.

This class is a container for facial feature points as defined by MPEG-4 FBA standard, as well as some additional feature points. Feature points are identified by their group (for example, feature points of the nose constitute their own group) and index. So, for example, the tip of the chin belongs to group 2 and has index 1, so it is identified as point 2.1. The identification of all feature points is illustrated in the image below:

Facial Feature Points (FP)
Physical contour

Groups 2 - 11 contain feature points defined according to the MPEG-4 FBA standard, and groups 12, 14, 16 and 17 contain additional feature points that are not part of the MPEG-4 standard (12.1, 12.5, 12.6, 12.7, 12.8, 12.9, 12.10, 12.11, 12.12, 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9, 14.10, 14.11, 14.12, 14.21, 14.22, 14.23, 14.24, 14.25, 16.1, 16.2, 16.3, 16.4, 16.5, 16.6, 16.7, 16.8, 16.9, 16.10, 16.11, 16.12, 16.13, 16.14, 16.15, 16.16, 16.17, 16.18, 16.19, 16.20, 16.21, 16.22, 16.23, 16.24, 16.25, 16.26, 16.27, 16.28, 17.5, 17.6, 17.7, 17.8, 17.9, 17.10, 17.11, 17.12, 17.13, 17.14, 17.15, 17.16, 17.17, 17.18, 17.19, 17.20).
Group 15 contains the physical contour points (15.1-15.17). Please note that point 15.17 is exactly identical to point 2.1 (2.1 point exists for MPEG-4 compatibility purposes).

FDP class stores feature point information. It also provides functions for reading and writing the feature point data as files.

The actual data for each feature point is stored in the structure FeaturePoint. One such structure is allocated for each feature point. To access a feature point, use one of the functions getFP() that access a feature point by its group and index expressed either as integer values, or as a string (e.g. "2.1"). Functions getFPPos() are available as a convenience, to access the feature point coordinates directly, without first accessing the FeaturePoint structure.

The feature points may relate to a particular 3D model. In such a case it is interesting to know, for each feature point, to which vertex it belongs. For this purpose, the FeaturePoint structure contains the mesh identifier and vertex index that correspond to the feature point and the FDP class provides functions to access this data.

Left-right convention

References to left and right in feature point definitions are given from the perspective of the face itself so "right eye" can be imagined as "my right eye". When refering to feature points in an image, it is assumed that image is taken by camera and not mirrored so "right eye" is on the left in the image, as shown in feature points illustration above.

See also
  FeaturePoint

Definition at line 191 of file FDP.h.

## Constructor & Destructor Documentation

## ◆ FDP() [1/3]

VisageSDK::FDP::FDP | ( |  | ) |

Constructor.

Creates an empty FDP object.

## ◆ FDP() [2/3]

VisageSDK::FDP::FDP | ( | const FDP & | featurePoints | ) |

Copy constructor.

Makes a copy of FDP object.

## ◆ FDP() [3/3]

VisageSDK::FDP::FDP | ( | const char * | fn | ) |

Constructor.

Parameters

  fn | FDP file.

## Member Function Documentation

## ◆ createNewFile()

void VisageSDK::FDP::createNewFile | ( | const char * | name | ) |

Create a new (empty) FDP file.

Parameters

  name | Filename.

## ◆ FPIsDefined() [1/2]

bool VisageSDK::FDP::FPIsDefined | ( | int | group,
|  | int | n
| ) |  | const

Returns true if the feature point is defined.

For more information see FeaturePoint::defined.

Parameters

  group | Feature point group. Valid range is from FDP::FP_START_GROUP_INDEX to FDP::FP_END_GROUP_INDEX.
  n | Feature point index. Valid range is from 1 to the size of particular group. Group sizes can be obtained using groupSize().

Returns
  True if the feature point is defined, false otherwise.

## ◆ FPIsDefined() [2/2]

bool VisageSDK::FDP::FPIsDefined | ( | const std::string & | name | ) | const

Returns true if the feature point is defined.

For more information see FeaturePoint::defined.

Parameters

  name | Feature point name (e.g. "7.1").

Returns
  True if the feature point is defined, false otherwise.

## ◆ FPIsDetected() [1/2]

bool VisageSDK::FDP::FPIsDetected | ( | int | group,
|  | int | n
| ) |  | const

Returns true if the feature point is detected.

For more information see FeaturePoint::detected.

Parameters

  group | Feature point group. Valid range is from FDP::FP_START_GROUP_INDEX to FDP::FP_END_GROUP_INDEX.
  n | Feature point index. Valid range is from 1 to the size of particular group. Group sizes can be obtained using groupSize().

Returns
  True if the feature point is detected, false otherwise.

## ◆ FPIsDetected() [2/2]

bool VisageSDK::FDP::FPIsDetected | ( | const std::string & | name | ) | const

Returns true if the feature point is detected.

For more information see FeaturePoint::detected.

Parameters

  name | Feature point name (e.g. "7.1").

Returns
  True if the feature point is detected, false otherwise.

## ◆ FPIsValid() [1/2]

static bool VisageSDK::FDP::FPIsValid | ( | int | group,
|  | int | n
| ) |  |
| static

Returns true if specified feature point identifier is valid.

Identifier is valid if it consists of feature point group and feature point index within valid ranges.

Parameters

  group | Feature point group. Valid range is from FDP::FP_START_GROUP_INDEX to FDP::FP_END_GROUP_INDEX.
  n | Feature point index. Valid range is from 1 to the size of particular group. Group sizes can be obtained using groupSize().

Returns
  True if specified feature point identifier is valid, false otherwise.

## ◆ FPIsValid() [2/2]

static bool VisageSDK::FDP::FPIsValid | ( | const std::string & | name | ) |
| static

Returns true if specified feature point identifier is valid.

Identifier i.e. feature point name is valid if it consists of feature point group and feature point index within valid ranges and is of the correct format. Valid range for feature point group is from FDP::FP_START_GROUP_INDEX to FDP::FP_END_GROUP_INDEX. Valid range for feature point index is from 1 to the size of particular group.

Parameters

  name | Feature point name (e.g. "7.1").

Returns
  True if specified feature point identifier is valid, false otherwise.

## ◆ getFP() [1/2]

const FeaturePoint& VisageSDK::FDP::getFP | ( | int | group,
|  | int | n
| ) |  | const

Get a feature point by its group and index.

Parameters

  group | Feature point group. Valid range is from FDP::FP_START_GROUP_INDEX to FDP::FP_END_GROUP_INDEX.
  n | Feature point index. Valid range is from 1 to the size of particular group. Group sizes can be obtained using groupSize().

Returns
  Feature point.

## ◆ getFP() [2/2]

const FeaturePoint& VisageSDK::FDP::getFP | ( | const char * | name | ) | const

Get a feature point by its name.

Parameters

  name | Feature point name (e.g. "7.1").

Returns
  Feature point.

## ◆ getFPName()

static std::string VisageSDK::FDP::getFPName | ( | int | group,
|  | int | n
| ) |  |
| static

Get feature point name from group and index.

Parameters

  group | Feature point group. Valid range is from FDP::FP_START_GROUP_INDEX to FDP::FP_END_GROUP_INDEX.
  n | Feature point index. Valid range is from 1 to the size of particular group. Group sizes can be obtained using groupSize().

Returns
  Feature point name.

## ◆ getFPPos() [1/2]

const float* VisageSDK::FDP::getFPPos | ( | int | group,
|  | int | n
| ) |  | const

Get the position of a feature point specified by its group and index.

Parameters

  group | Feature point group. Valid range is from FDP::FP_START_GROUP_INDEX to FDP::FP_END_GROUP_INDEX.
  n | Feature point index. Valid range is from 1 to the size of particular group. Group sizes can be obtained using groupSize().

Returns
  Vertex position (array of 3 floating point numbers).

## ◆ getFPPos() [2/2]

const float* VisageSDK::FDP::getFPPos | ( | const char * | name | ) | const

Get the position of a feature point specified by its name.

Parameters

  name | Feature point name (e.g. "7.1").

Returns
  Vertex position (array of 3 floating point numbers).

## ◆ getFPQuality() [1/2]

float VisageSDK::FDP::getFPQuality | ( | int | group,
|  | int | n
| ) |  | const

Get the quality of a feature point specified by its group and index.

Parameters

  group | Feature point group. Valid range is from FDP::FP_START_GROUP_INDEX to FDP::FP_END_GROUP_INDEX.
  n | Feature point index. Valid range is from 1 to the size of particular group. Group sizes can be obtained using groupSize().

Returns
  quality value.

## ◆ getFPQuality() [2/2]

float VisageSDK::FDP::getFPQuality | ( | const char * | name | ) | const

Get the quality of a feature point specified by its name.

Parameters

  name | Feature point name (e.g. "7.1").

Returns
  quality value.

## ◆ getFPSurfVert() [1/2]

bool VisageSDK::FDP::getFPSurfVert | ( | int | group,
|  | int | n,
|  | std::string & | surf,
|  | int & | vert
| ) |  | const

Get the mesh and vertex mapping for a feature point specified by its group and index.

Parameters

  group | Feature point group. Valid range is from FDP::FP_START_GROUP_INDEX to FDP::FP_END_GROUP_INDEX.
  n | Feature point index. Valid range is from 1 to the size of particular group. Group sizes can be obtained using groupSize().
  surf | Returned mesh identifier.
  vert | Returned vertex index.

Returns
  True if feature point is defined, false if not.

## ◆ getFPSurfVert() [2/2]

bool VisageSDK::FDP::getFPSurfVert | ( | const char * | name,
|  | std::string & | surf,
|  | int & | vert
| ) |  | const

Get the mesh and vertex mapping for a feature point specified by its name.

Parameters

  name | Feature point name (e.g. "7.1").
  surf | Returned mesh identifier.
  vert | Returned vertex index.

Returns
  True if feature point is defined, false if not.

## ◆ getMirrorPointIndex()

static int VisageSDK::FDP::getMirrorPointIndex | ( | int | group,
|  | int | index
| ) |  |
| static

Get the mirror point index for the point defined by given group and index.

Parameters

  group | Feature point group. Valid range is from FDP::FP_START_GROUP_INDEX to FDP::FP_END_GROUP_INDEX.
  index | Feature point index. Valid range is from 1 to the size of particular group. Group sizes can be obtained using groupSize().

Returns
  Index of the mirror point (group is the same).

## ◆ groupSize()

static int VisageSDK::FDP::groupSize | ( | int | group | ) |
| static

Get the size of the specified feature point group.

Valid range for group is from FDP::FP_START_GROUP_INDEX to FDP::FP_END_GROUP_INDEX.

Parameters

  group | Feature point group. Valid range is from FDP::FP_START_GROUP_INDEX to FDP::FP_END_GROUP_INDEX.

Returns
  Size of the specified feature point group.

## ◆ parseFPName()

static void VisageSDK::FDP::parseFPName | ( | const std::string & | name,
|  | int & | group,
|  | int & | n
| ) |  |
| static

Get feature point group and index from its name.

Parameters

  name | Feature point name (e.g. "7.1").
  group | Returned feature point group.
  n | Returned feature point index.

## ◆ readFromFile()

int VisageSDK::FDP::readFromFile | ( | const char * | name | ) |

Read from an FDP file.

The FDP file format consists of one line of text for each feature point, in the following format: (group).(index) (x) (y) (z) (mesh_index).(vertex_index)

Parameters

  name | Filename.

Returns
  0 - failure, 1 - success, -1 - old version, needs reindexing.

## ◆ reset()

void VisageSDK::FDP::reset | ( |  | ) |

Resets all feature points.

The value of all feature points is set to "undefined".

## ◆ saveToFile() [1/2]

void VisageSDK::FDP::saveToFile | ( |  | ) | const

Write feature point definitions to the current FDP file.

File name is the one currently used.

## ◆ saveToFile() [2/2]

void VisageSDK::FDP::saveToFile | ( | const char * | fileName | ) |

Write feature point definitions to the FDP file, changing the FDP file name.

Parameters

  fileName | Filename.

## ◆ setFP() [1/2]

void VisageSDK::FDP::setFP | ( | int | group,
|  | int | n,
|  | const FeaturePoint & | f
| ) |  |

Set a feature specified by its group and index.

Parameters

  group | Feature point group. Valid range is from FDP::FP_START_GROUP_INDEX to FDP::FP_END_GROUP_INDEX.
  n | Feature point index. Valid range is from 1 to the size of particular group. Group sizes can be obtained using groupSize().
  f | The feature point to set.

## ◆ setFP() [2/2]

void VisageSDK::FDP::setFP | ( | const char * | name,
|  | const FeaturePoint & | f
| ) |  |

Set a feature specified by its name.

Parameters

  name | Feature point name (e.g. "7.1").
  f | The feature point to set.

## ◆ setFPPos() [1/4]

void VisageSDK::FDP::setFPPos | ( | int | group,
|  | int | n,
|  | const float * | pos
| ) |  |

Set the position of a feature point specified by its group and index.

Parameters

  group | Feature point group. Valid range is from FDP::FP_START_GROUP_INDEX to FDP::FP_END_GROUP_INDEX.
  n | Feature point index. Valid range is from 1 to the size of particular group. Group sizes can be obtained using groupSize().
  pos | Vertex position (array of 3 floating point values).

## ◆ setFPPos() [2/4]

void VisageSDK::FDP::setFPPos | ( | const char * | name,
|  | const float * | pos
| ) |  |

Set the position of a feature point specified by its name.

Parameters

  name | Feature point name (e.g. "7.1").
  pos | Vertex position (array of 3 floating point values).

## ◆ setFPPos() [3/4]

void VisageSDK::FDP::setFPPos | ( | int | group,
|  | int | n,
|  | float | x,
|  | float | y,
|  | float | z
| ) |  |

Set the position of a feature point specified by its group and index.

Parameters

  group | Feature point group. Valid range is from FDP::FP_START_GROUP_INDEX to FDP::FP_END_GROUP_INDEX.
  n | Feature point index. Valid range is from 1 to the size of particular group. Group sizes can be obtained using groupSize().
  x | Vertex x position.
  y | Vertex y position.
  z | Vertex z position.

## ◆ setFPPos() [4/4]

void VisageSDK::FDP::setFPPos | ( | const char * | name,
|  | float | x,
|  | float | y,
|  | float | z
| ) |  |

Set the position of a feature point specified by its name.

Parameters

  name | Feature point name (e.g. "7.1").
  x | Vertex x position.
  y | Vertex y position.
  z | Vertex z position.

## ◆ setFPQuality() [1/2]

void VisageSDK::FDP::setFPQuality | ( | int | group,
|  | int | n,
|  | const float | quality
| ) |  |

Set the quality of a feature point specified by its group and index.

Parameters

  group | Feature point group. Valid range is from FDP::FP_START_GROUP_INDEX to FDP::FP_END_GROUP_INDEX.
  n | Feature point index. Valid range is from 1 to the size of particular group. Group sizes can be obtained using groupSize().
  quality | quality value.

## ◆ setFPQuality() [2/2]

void VisageSDK::FDP::setFPQuality | ( | const char * | name,
|  | const float | quality
| ) |  |

Set the position of a feature point specified by its name.

Parameters

  name | Feature point name (e.g. "7.1").
  quality | quality value.

## ◆ setFPSurfVert() [1/2]

void VisageSDK::FDP::setFPSurfVert | ( | int | group,
|  | int | n,
|  | const std::string & | surf,
|  | int | vert
| ) |  |

Assign a feature point, specified by its group and index, to a specific vertex.

Parameters

  group | Feature point group. Valid range is from FDP::FP_START_GROUP_INDEX to FDP::FP_END_GROUP_INDEX.
  n | Feature point index. Valid range is from 1 to the size of particular group. Group sizes can be obtained using groupSize().
  surf | Mesh id.
  vert | Vertex index.

## ◆ setFPSurfVert() [2/2]

void VisageSDK::FDP::setFPSurfVert | ( | const char * | name,
|  | const std::string & | surf,
|  | int | vert
| ) |  |

Assign a feature point, specified by its name, to a specific vertex.

Parameters

  name | Feature point name (e.g. "7.1").
  surf | Mesh id.
  vert | Vertex index.

## Member Data Documentation

## ◆ FP_END_GROUP_INDEX

const int VisageSDK::FDP::FP_END_GROUP_INDEX = 17
| static

Index of the last feature point group.

Returns
  17

Definition at line 464 of file FDP.h.

## ◆ FP_START_GROUP_INDEX

const int VisageSDK::FDP::FP_START_GROUP_INDEX = 2
| static

Index of the first feature point group.

Returns
  2

Definition at line 458 of file FDP.h.

The documentation for this class was generated from the following file:

- FDP.h