visageSDK

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Public Member Functions | List of all members
VisageSDK::VisageConfiguration Class Reference

VisageConfiguration is a class used to change, apply, load and save configuration parameters used by VisageTracker. More...

`#include <VisageConfiguration.h>`

## Public Member Functions
| VisageConfiguration (const char *trackerConfigFile)
| Constructor. More...
| VisageConfiguration (const VisageConfiguration &configuration)
| Copy constructor. More...
float | getCameraFocus () const
| Returns the value of the camera_focus parameter. More...
float | getRecoveryTimeout () const
| Returns the value of the recovery_timeout parameter. More...
VsCfgArr< float > | getSmoothingFactors () const
| Returns the value of the smoothing_factors parameter. More...
unsigned int | getEnableSmoothing () const
| Returns the value of the enable_smoothing parameter. More...
unsigned int | getTemporallyDenoiseInput () const
| Returns the value of the temporally_denoise_input parameter. More...
const std::string & | getVftDataPath () const
| Returns the value of the vft_data_path parameter. More...
const std::string & | getVfdDataPath () const
| Returns the value of the vfd_data_path parameter. More...
const std::string & | getPrDataPath () const
| Returns the value of the pr_data_path parameter. More...
const std::string & | getErDataPath () const
| Returns the value of the er_data_path parameter. More...
unsigned int | getProcessEyes () const
| Returns the value of the process_eyes parameter. More...
unsigned int | getRefineLandmarks () const
| Returns the value of the refine_landmarks parameter. More...
unsigned int | getRefineEars () const
| Returns the value of the refine_ears parameter. More...
float | getMinFaceScale () const
| Returns the value of the min_face_scale parameter. More...
float | getMaxFaceScale () const
| Returns the value of the max_face_scale parameter. More...
float | getFaceDetectorSensitivity () const
| Returns the value of the face_detector_sensitivity parameter. More...
const std::string & | getPoseFittingModelConfiguration () const
| Returns the value of the pose_fitting_model_configuration parameter. More...
const std::string & | getAuFittingModelConfiguration () const
| Returns the value of the au_fitting_model_configuration parameter. More...
const std::string & | getMeshFittingModelConfiguration () const
| Returns the value of the mesh_fitting_model_configuration parameter. More...
bool | setCameraFocus (float camera_focus)
| Sets the value of the camera_focus parameter. More...
bool | setRecoveryTimeout (float recovery_timeout)
| Sets the value of the recovery_timeout parameter. More...
bool | setSmoothingFactors (const VsCfgArr< float > &smoothing_factors)
| Sets the values of the smoothing_factors parameter. More...
bool | setEnableSmoothing (unsigned int enable_smoothing)
| Sets the values of the enable_smoothing parameter. More...
bool | setTemporallyDenoiseInput (unsigned int temporally_denoise_input)
| Sets the values of the temporally_denoise_input parameter. More...
bool | setVftDataPath (std::string vft_data_path)
| Sets the value of the vft_data_path parameter. More...
bool | setVfdDataPath (std::string vfd_data_path)
| Sets the value of the vfd_data_path parameter. More...
bool | setPrDataPath (std::string pr_data_path)
| Sets the value of the pr_data_path parameter. More...
bool | setErDataPath (std::string er_data_path)
| Sets the value of the er_data_path parameter. More...
bool | setProcessEyes (unsigned int process_eyes)
| Sets the value of the process_eyes parameter. More...
bool | setRefineLandmarks (unsigned int refine_landmarks)
| Sets the value of the refine_landmarks parameter. More...
bool | setRefineEars (unsigned int refine_ears)
| Sets the value of the refine_ears parameter. More...
bool | setMinFaceScale (float min_face_scale)
| Sets the value of the min_face_scale parameter. More...
bool | setMaxFaceScale (float max_face_scale)
| Sets the value of the max_face_scale parameter. More...
bool | setFaceDetectorSensitivity (float face_detector_sensitivity)
| Sets the value of the face_detector_sensitivity parameter. More...
bool | setPoseFittingModelConfiguration (std::string pose_fitting_model_configuration)
| Sets the value of the pose_fitting_model_configuration parameter. More...
bool | setAuFittingModelConfiguration (std::string au_fitting_model_configuration)
| Sets the value of the au_fitting_model_configuration parameter. More...
bool | setMeshFittingModelConfiguration (std::string mesh_fitting_model_configuration)
| Sets the value of the mesh_fitting_model_configuration parameter. More...
void | enableAuModel ()
| Enables the use of the 3D model used to estimate action units (au_fitting_model_configuration configuration parameter).
void | enableMeshModel ()
| Enables the use of the fine 3D mesh (mesh_fitting_model_configuration configuration parameter).
void | disableAuModel ()
| Disables the use of the 3D model used to estimate action units (au_fitting_model_configuration configuration parameter).
void | disableMeshModel ()
| Disables the use of the fine 3D mesh (mesh_fitting_model_configuration configuration parameter).
bool | setConfigurationFile (const char *trackerConfigFile)
| Reads and loads values from a specified configuration (*.cfg) file. More...
VisageConfiguration & | operator= (VisageConfiguration configuration)
| Copy assignment operator. More...

## Detailed Description

VisageConfiguration is a class used to change, apply, load and save configuration parameters used by VisageTracker.

The idea behind this interface is for a user to:

- obtain a copy of the VisageConfiguration object from VisageTracker,
- apply the desired changes on the VisageConfiguration object and,
- send the modified object back to the VisageTracker

As a direct result of this implementation, the VisageConfiguration default constructor is private and it is expected and encouraged that the initial copy is obtained from the VisageTracker. Alternatively, VisageConfiguration can also be constructed by passing a path to the valid .cfg file using VisageConfiguration::VisageConfiguration(const char* trackerConfigFile).

Setting and getting of the VisageConfiguration object is thread-safe, i.e. methods can be invoked from another thread.

## Obtaining a copy of the VC object

A copy of the VisageTracker internal member can be obtained by calling VisageTracker::getTrackerConfiguration() method as demonstrated in the code example below:

* VisageTracker* m_Tracker = new VisageTracker(defaultConfigFile);
* // Obtain a copy of internal VisageConfiguration member
* VisageConfiguration m_Configuration = m_Tracker->getTrackerConfiguration();
*

## Applying changes on the VC object

The interface of the VisageConfiguration class is designed so the parameters cannot be accessed directly, instead, each parameter has its own getter and setter function. After a local copy is obtained, a setter function can be called. Setter functions perform input validation to verify that the value passed to the function is: a) within a certain range, b) not empty, or c) otherwise valid. Thus, the return parameter of the setter function is a boolean and if the value passed as an argument is invalid, the setter function will return false. Otherwise, if the value of the parameter was successfully changed, the function will return true.

A detailed description of each particular configuration parameter, including valid ranges and other specifics, are available in the VisageTracker Configuration Manual.

Parameters of the VisageConfiguration class can be divided into two categories:

- primitive type parameters (booleans, integers, floats, strings)
- arrays of different types (integers, floats, strings)

Following code example demonstrates a modification of primitive type parameters by modifying the camera_focus configuration parameter:

* // Obtain a copy of internal VisageConfiguration member
* VisageConfiguration m_Configuration = m_Tracker->getTrackerConfiguration();
* bool success = m_Configuration.setCameraFocus(5.0f);
* if (success)
* //The parameter was changed successfully
* else
* //The operation failed
*

A new template struct, VsCfgArr, has been introduced for storing array-type parameters. This structure can hold arrays of various types including short, integer, float, double and string. VsCfgArr is used exclusively in conjunction with VisageConfiguration interface.

Following code example demonstrates a modification of array-type parameters by modifying the smoothing_factors configuration parameter:

* // Obtain a copy of internal VisageConfiguration member
* VisageConfiguration m_Configuration = m_Tracker->getTrackerConfiguration();
* VsCfgArr<float> smoothingFactors = m_Configuration->getSmoothingFactors();
* smoothingFactors[0] = 2.0f;
* bool success = m_Configuration.setSmoothingFactors(smoothingFactors);
* if (success)
* //The parameter was changed successfully
* else
* //The operation failed
*

See the detailed page of the VsCfgArr structure for code examples demonstrating:

- creating the structure,
- accessing and reading values stored within VsCfgArr object,
- modifying values stored in a VsCfgArr object

Once the changes have been applied, the local copy needs to be applied to the tracker for the changes to take effect.

## Sending the object to VisageTracker

VisageTracker provides an overloaded method VisageTracker::setTrackerConfiguration(VisageConfiguration& vc). A reference of the local object is passed to the VisageTracker and copied to the internal member. Usage is demonstrated in the code example below:

* // Assuming m_Configuration object has been obtained as in example above
* m_Tracker->setTrackerConfiguration(m_Configuration);
*

The parameters' values of the sent configuration object will be used in the next tracking session (i.e. when VisageTracker::track() is called).

Definition at line 272 of file VisageConfiguration.h.

## Constructor & Destructor Documentation

VisageSDK::VisageConfiguration::VisageConfiguration | ( | const char * | trackerConfigFile | ) |

Constructor.

Creates a new instance of the VisageConfiguration class by reading a specified configuration (*.cfg) file.

Parameters

  trackerConfigFile | Path to a specified configuration (*.cfg) file.

VisageSDK::VisageConfiguration::VisageConfiguration | ( | const VisageConfiguration & | configuration | ) |

Copy constructor.

Creates a new instance of the VisageConfiguration class by copying an already existing instance.

Parameters

  configuration | Reference to pre-existing VisageConfiguration object.

## Member Function Documentation

const std::string& VisageSDK::VisageConfiguration::getAuFittingModelConfiguration | ( |  | ) | const

Returns the value of the au_fitting_model_configuration parameter.

Returns
  String containing path of the au_fitting_model_configuration parameter.

float VisageSDK::VisageConfiguration::getCameraFocus | ( |  | ) | const

Returns the value of the camera_focus parameter.

Returns
  Float value of the camera_focus parameter

unsigned int VisageSDK::VisageConfiguration::getEnableSmoothing | ( |  | ) | const

Returns the value of the enable_smoothing parameter.

Returns
  Unsigned integer value of the enable_smoothing parameter.

const std::string& VisageSDK::VisageConfiguration::getErDataPath | ( |  | ) | const

Returns the value of the er_data_path parameter.

Returns
  String containing the path of the er_data_path parameter.

float VisageSDK::VisageConfiguration::getFaceDetectorSensitivity | ( |  | ) | const

Returns the value of the face_detector_sensitivity parameter.

Returns
  Float value of the face_detector_sensitivity parameter.

float VisageSDK::VisageConfiguration::getMaxFaceScale | ( |  | ) | const

Returns the value of the max_face_scale parameter.

Returns
  Float value of the max_face_scale parameter.

const std::string& VisageSDK::VisageConfiguration::getMeshFittingModelConfiguration | ( |  | ) | const

Returns the value of the mesh_fitting_model_configuration parameter.

Returns
  String containing path of the mesh_fitting_model_configuration parameter.

float VisageSDK::VisageConfiguration::getMinFaceScale | ( |  | ) | const

Returns the value of the min_face_scale parameter.

Returns
  Float value of the min_face_scale parameter.

const std::string& VisageSDK::VisageConfiguration::getPoseFittingModelConfiguration | ( |  | ) | const

Returns the value of the pose_fitting_model_configuration parameter.

Returns
  String containing path of the pose_fitting_model_configuration parameter.

const std::string& VisageSDK::VisageConfiguration::getPrDataPath | ( |  | ) | const

Returns the value of the pr_data_path parameter.

Returns
  String containing the path of the pr_data_path parameter.

unsigned int VisageSDK::VisageConfiguration::getProcessEyes | ( |  | ) | const

Returns the value of the process_eyes parameter.

Returns
  Unsigned integer value of the process_eyes parameter.

float VisageSDK::VisageConfiguration::getRecoveryTimeout | ( |  | ) | const

Returns the value of the recovery_timeout parameter.

Returns
  Float value of the recovery_timeout parameter.

unsigned int VisageSDK::VisageConfiguration::getRefineEars | ( |  | ) | const

Returns the value of the refine_ears parameter.

Returns
  Unsigned integer value of the refine_ears parameter.

unsigned int VisageSDK::VisageConfiguration::getRefineLandmarks | ( |  | ) | const

Returns the value of the refine_landmarks parameter.

Returns
  Unsigned integer value of the refine_landmarks parameter.

VsCfgArr<float> VisageSDK::VisageConfiguration::getSmoothingFactors | ( |  | ) | const

Returns the value of the smoothing_factors parameter.

Returns
  VsCfgArr containing float values of the smoothing_factors parameter.

unsigned int VisageSDK::VisageConfiguration::getTemporallyDenoiseInput | ( |  | ) | const

Returns the value of the temporally_denoise_input parameter.

Returns
  Unsigned integer value of the temporally_denoise_input parameter.

const std::string& VisageSDK::VisageConfiguration::getVfdDataPath | ( |  | ) | const

Returns the value of the vfd_data_path parameter.

Returns
  String containing the path of the vfd_data_path parameter.

const std::string& VisageSDK::VisageConfiguration::getVftDataPath | ( |  | ) | const

Returns the value of the vft_data_path parameter.

Returns
  String containing the path of the vft_data_path parameter.

VisageConfiguration& VisageSDK::VisageConfiguration::operator= | ( | VisageConfiguration | configuration | ) |

Copy assignment operator.

Copies the values of one VisageConfiguration object to another.

Parameters

  configuration | VisageConfiguration object to copy values from

bool VisageSDK::VisageConfiguration::setAuFittingModelConfiguration | ( | std::string | au_fitting_model_configuration | ) |

Sets the value of the au_fitting_model_configuration parameter.

This function sets the .cfg (au_fitting_model_configuration) file used for action unit fitting. The path to the model configuration must be relative to the configuration file used for tracker initialization. The model will be disabled if the passed string is empty ("") or "none".

NOTE: Changing the model configuration may affect the sizes of arrays in the FaceData object populated with values from the model file.

Parameters

  au_fitting_model_configuration | String path to the model file

Returns
  True if the parameter was changed, false if the input file does not exist

bool VisageSDK::VisageConfiguration::setCameraFocus | ( | float | camera_focus | ) |

Sets the value of the camera_focus parameter.

Value must be greater than zero.

Parameters

  camera_focus | Float value

Returns
  True if the parameter was changed, false if the input was invalid

bool VisageSDK::VisageConfiguration::setConfigurationFile | ( | const char * | trackerConfigFile | ) |

Reads and loads values from a specified configuration (*.cfg) file.

Parameters

  trackerConfigFile | Path to a configuration (*.cfg) file

bool VisageSDK::VisageConfiguration::setEnableSmoothing | ( | unsigned int | enable_smoothing | ) |

Sets the values of the enable_smoothing parameter.

Value can be 0 or 1.

Parameters

  enable_smoothing | Integer value

Returns
  True if the parameter was changed, false if the input was invalid

bool VisageSDK::VisageConfiguration::setErDataPath | ( | std::string | er_data_path | ) |

Sets the value of the er_data_path parameter.

The path must be relative to the configuration file used for tracker initialization and not empty.

Parameters

  er_data_path | String path to the folder containing ears' refinement data files

Returns
  True if the parameter was changed, false if the input was invalid

bool VisageSDK::VisageConfiguration::setFaceDetectorSensitivity | ( | float | face_detector_sensitivity | ) |

Sets the value of the face_detector_sensitivity parameter.

Value must be greater than 0.0 and less than or equal to 1.0.

Parameters

  face_detector_sensitivity | Float value

Returns
  True if the parameter was changed, false if the input was invalid

bool VisageSDK::VisageConfiguration::setMaxFaceScale | ( | float | max_face_scale | ) |

Sets the value of the max_face_scale parameter.

Value must be greater than 0.0 and less than or equal to 1.0.

Parameters

  max_face_scale | Float value

Returns
  True if the parameter was changed, false if the input was invalid

bool VisageSDK::VisageConfiguration::setMeshFittingModelConfiguration | ( | std::string | mesh_fitting_model_configuration | ) |

Sets the value of the mesh_fitting_model_configuration parameter.

This function sets the .cfg (mesh_fitting_model_configuration) file used for mesh fitting. The path to the model configuration must be relative to the configuration file used for tracker initialization. The model will be disabled if the passed string is empty ("") or "none".

NOTE: Changing the model configuration may affect the sizes of arrays in the FaceData object populated with values from the model file.

Parameters

  mesh_fitting_model_configuration | String path to the model file

Returns
  True if the parameter was changed, false if the input file does not exist

bool VisageSDK::VisageConfiguration::setMinFaceScale | ( | float | min_face_scale | ) |

Sets the value of the min_face_scale parameter.

Value must be greater than 0.0 and less than or equal to 1.0.

Parameters

  min_face_scale | Float value

Returns
  True if the parameter was changed, false if the input was invalid

bool VisageSDK::VisageConfiguration::setPoseFittingModelConfiguration | ( | std::string | pose_fitting_model_configuration | ) |

Sets the value of the pose_fitting_model_configuration parameter.

This function sets the .cfg (pose_fitting_model_configuration) file used for pose fitting. The path to the model configuration must be relative to the configuration file used for tracker initialization. The model will be disabled if the passed string is empty ("") or "none".

NOTE: Changing the model configuration may affect the sizes of arrays in the FaceData object populated with values from the model file.

Parameters

  pose_fitting_model_configuration | String path to the model file

Returns
  True if the parameter was changed, false if the input file does not exist

bool VisageSDK::VisageConfiguration::setPrDataPath | ( | std::string | pr_data_path | ) |

Sets the value of the pr_data_path parameter.

The path must be relative to the configuration file used for tracker initialization and not empty.

Parameters

  pr_data_path | String path to the folder containing pupils' refinement data files

Returns
  True if the parameter was changed, false if the input was invalid

bool VisageSDK::VisageConfiguration::setProcessEyes | ( | unsigned int | process_eyes | ) |

Sets the value of the process_eyes parameter.

Value can only be 0, 1, 2, or 3.

Parameters

  process_eyes | Integer value

Returns
  True if the parameter was changed, false if the input was invalid

bool VisageSDK::VisageConfiguration::setRecoveryTimeout | ( | float | recovery_timeout | ) |

Sets the value of the recovery_timeout parameter.

Value must be greater than or equal to zero and not a NaN value.

Parameters

  recovery_timeout | Float value

Returns
  True if the parameter was changed, false if the input was invalid

bool VisageSDK::VisageConfiguration::setRefineEars | ( | unsigned int | refine_ears | ) |

Sets the value of the refine_ears parameter.

Value can only be 0 or 1.

Parameters

  refine_ears | Integer value

Returns
  True if the parameter was changed, false if the input was invalid

bool VisageSDK::VisageConfiguration::setRefineLandmarks | ( | unsigned int | refine_landmarks | ) |

Sets the value of the refine_landmarks parameter.

Value can be 0 or 1.

Parameters

  refine_landmarks | Integer value

Returns
  True if the parameter was changed, false if the input was invalid

bool VisageSDK::VisageConfiguration::setSmoothingFactors | ( | const VsCfgArr< float > & | smoothing_factors | ) |

Sets the values of the smoothing_factors parameter.

Values must not be a NaN value.

Parameters

  smoothing_factors | Reference to a VsCfgArr containing float values

Returns
  True if the parameter was changed, false if the input was invalid

bool VisageSDK::VisageConfiguration::setTemporallyDenoiseInput | ( | unsigned int | temporally_denoise_input | ) |

Sets the values of the temporally_denoise_input parameter.

Value can be 0 or 1.

Parameters

  temporally_denoise_input | Integer value

Returns
  True if the parameter was changed, false if the input was invalid

bool VisageSDK::VisageConfiguration::setVfdDataPath | ( | std::string | vfd_data_path | ) |

Sets the value of the vfd_data_path parameter.

The path must be relative to the configuration file used for tracker initialization and not empty.

Parameters

  vfd_data_path | String path to the folder containing algorithm data file required by tracker and detector

Returns
  True if the parameter was changed, false if the input was invalid

bool VisageSDK::VisageConfiguration::setVftDataPath | ( | std::string | vft_data_path | ) |

Sets the value of the vft_data_path parameter.

The path must be relative to the configuration file used for tracker initialization and not empty.

Parameters

  vft_data_path | String path to the folder containing tracking algorithm data files required by tracker

Returns
  True if the parameter was changed, false if the input was invalid

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

- VisageConfiguration.h