|
visageSDK
|
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. | |
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:
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.
| VisageSDK::FDP::FDP | ( | ) |
Constructor.
Creates an empty FDP object.
| VisageSDK::FDP::FDP | ( | const char * | fn | ) |
Constructor.
| fn | FDP file. |
| void VisageSDK::FDP::createNewFile | ( | const char * | name | ) |
Create a new (empty) FDP file.
| name | Filename. |
| bool VisageSDK::FDP::FPIsDefined | ( | const std::string & | name | ) | const |
Returns true if the feature point is defined.
For more information see FeaturePoint::defined.
| name | Feature point name (e.g. "7.1"). |
| bool VisageSDK::FDP::FPIsDefined | ( | int | group, |
| int | n | ||
| ) | const |
Returns true if the feature point is defined.
For more information see FeaturePoint::defined.
| 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(). |
| bool VisageSDK::FDP::FPIsDetected | ( | const std::string & | name | ) | const |
Returns true if the feature point is detected.
For more information see FeaturePoint::detected.
| name | Feature point name (e.g. "7.1"). |
| bool VisageSDK::FDP::FPIsDetected | ( | int | group, |
| int | n | ||
| ) | const |
Returns true if the feature point is detected.
For more information see FeaturePoint::detected.
| 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(). |
|
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.
| name | Feature point name (e.g. "7.1"). |
|
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.
| 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(). |
| const FeaturePoint& VisageSDK::FDP::getFP | ( | const char * | name | ) | const |
Get a feature point by its name.
| name | Feature point name (e.g. "7.1"). |
| const FeaturePoint& VisageSDK::FDP::getFP | ( | int | group, |
| int | n | ||
| ) | const |
Get a feature point by its group and index.
| 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(). |
|
static |
Get feature point name from group and index.
| 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(). |
| const float* VisageSDK::FDP::getFPPos | ( | const char * | name | ) | const |
Get the position of a feature point specified by its name.
| name | Feature point name (e.g. "7.1"). |
| const float* VisageSDK::FDP::getFPPos | ( | int | group, |
| int | n | ||
| ) | const |
Get the position of a feature point specified by its group and index.
| 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(). |
| float VisageSDK::FDP::getFPQuality | ( | const char * | name | ) | const |
Get the quality of a feature point specified by its name.
| name | Feature point name (e.g. "7.1"). |
| float VisageSDK::FDP::getFPQuality | ( | int | group, |
| int | n | ||
| ) | const |
Get the quality of a feature point specified by its group and index.
| 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(). |
| 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.
| name | Feature point name (e.g. "7.1"). |
| surf | Returned mesh identifier. |
| vert | Returned vertex index. |
| 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.
| 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. |
|
static |
Get the mirror point index for the point defined by given group and index.
| 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(). |
|
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.
| group | Feature point group. Valid range is from FDP::FP_START_GROUP_INDEX to FDP::FP_END_GROUP_INDEX. |
|
static |
Get feature point group and index from its name.
| name | Feature point name (e.g. "7.1"). |
| group | Returned feature point group. |
| n | Returned feature point index. |
| int VisageSDK::FDP::readFromFile | ( | const char * | name | ) |
| void VisageSDK::FDP::reset | ( | ) |
Resets all feature points.
The value of all feature points is set to "undefined".
| void VisageSDK::FDP::saveToFile | ( | ) | const |
Write feature point definitions to the current FDP file.
File name is the one currently used.
| void VisageSDK::FDP::saveToFile | ( | const char * | fileName | ) |
| void VisageSDK::FDP::setFP | ( | const char * | name, |
| const FeaturePoint & | f | ||
| ) |
Set a feature specified by its name.
| name | Feature point name (e.g. "7.1"). |
| f | The feature point to set. |
| void VisageSDK::FDP::setFP | ( | int | group, |
| int | n, | ||
| const FeaturePoint & | f | ||
| ) |
Set a feature specified by its group and index.
| 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. |
| void VisageSDK::FDP::setFPPos | ( | const char * | name, |
| const float * | pos | ||
| ) |
Set the position of a feature point specified by its name.
| name | Feature point name (e.g. "7.1"). |
| pos | Vertex position (array of 3 floating point values). |
| void VisageSDK::FDP::setFPPos | ( | const char * | name, |
| float | x, | ||
| float | y, | ||
| float | z | ||
| ) |
Set the position of a feature point specified by its name.
| name | Feature point name (e.g. "7.1"). |
| x | Vertex x position. |
| y | Vertex y position. |
| z | Vertex z position. |
| void VisageSDK::FDP::setFPPos | ( | int | group, |
| int | n, | ||
| const float * | pos | ||
| ) |
Set the position of a feature point specified by its group and index.
| 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). |
| 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.
| 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. |
| void VisageSDK::FDP::setFPQuality | ( | const char * | name, |
| const float | quality | ||
| ) |
Set the position of a feature point specified by its name.
| name | Feature point name (e.g. "7.1"). |
| quality | quality value. |
| void VisageSDK::FDP::setFPQuality | ( | int | group, |
| int | n, | ||
| const float | quality | ||
| ) |
Set the quality of a feature point specified by its group and index.
| 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. |
| 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.
| name | Feature point name (e.g. "7.1"). |
| surf | Mesh id. |
| vert | Vertex index. |
| 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.
| 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. |
|
static |
|
static |
1.8.17