|
visageSDK
|
Provides high-level functions for using visage|SDK face analysis capabilities in Unity game engine. More...
Classes | |
| struct | ManagedAnalysisData |
| Managed equivalent of the native AnalysisData structure, used as a container for all face analysis results. More... | |
Functions | |
| int | _initAnalyser (string dataPath) |
| Initialises VisageFaceAnalyser. More... | |
| void | _releaseAnalyser () |
| Releases memory allocated by the face analyser in the _initAnalyser() function. More... | |
| VFAReturnCode | _analyseImage (int faceIndex, int options, ManagedAnalysisData &results) |
| Performs the specified face analysis tasks on a given image and outputs results to ManagedAnalysisData object instance. More... | |
| VFAReturnCode | _analyseStream (int faceIndex, int options, ManagedAnalysisData &results) |
| Performs the specified face analysis tasks on a given frame and outputs results to ManagedAnalysisData object instance. More... | |
| bool | _prepareDataForAnalysis () |
| Prepares data obtained by the track function. | |
Provides high-level functions for using visage|SDK face analysis capabilities in Unity game engine.
It implements high-level wrapper functions from visage|SDK that enable usage of visage|SDK face analysis capabilities in Unity C# scripts.
VisageFaceAnalyser contains face analysis algorithms for estimating age, gender and emotion from facial images/frames.
The functionality of VisageFaceAnalyser is dependent on the VisageTracker and it is expected that prior to the call of VisageFaceAnalyser's functions frame is processed with _track() function and the data thus obtained is prepared and forwarded to VisageFaceAnalyser.
Before using VisageFaceAnalyser, it must be initialized by calling the _initAnalyser() function. Afterward, in each frame, the _prepareDataForAnalysis() function is called first, followed by calling _analyseStream() function, otherwise analysis will fail which will be indicated by function's return code.
VisageFaceAnalyser's functionality can be used in a separate thread.
| VFAReturnCode _analyseImage | ( | int | faceIndex, |
| int | options, | ||
| ManagedAnalysisData & | results | ||
| ) |
Performs the specified face analysis tasks on a given image and outputs results to ManagedAnalysisData object instance.
This function is primarily intended for performing face analysis on a single image, or consecutive unrelated images. As such, it outputs raw, unfiltered estimation data without smoothing or averaging.
| faceIndex | Value between 0 and MAX_FACES-1, used to access the data of a particular tracked face. |
| options | Bitwise combination of the native VFAFlags enumeration which determines the analysis operations to be performed. |
| results | Managed equivalent of AnalysisData structure, used as a container for all face analysis results. |
| VFAReturnCode _analyseStream | ( | int | faceIndex, |
| int | options, | ||
| ManagedAnalysisData & | results | ||
| ) |
Performs the specified face analysis tasks on a given frame and outputs results to ManagedAnalysisData object instance.
This function is primarily intended for performing face analysis on a continuous stream of related frames, such as a video or camera feed. Sampling face analysis data from multiple frames can increase estimation accuracy by averaging the result over multiple frames. Internally, the suitability of frames chosen for analysis is continually evaluted based on head pose and overall tracking quality. This guarantees that the analysis buffer is always working with the best available frames, ensuring highest possible estimation accuracy.
An example of use:
| faceIndex | Value between 0 and MAX_FACES-1, used to access the data of a particular tracked face. |
| options | Bitwise combination of the native VFAFlags enumeration which determines the analysis operations to be performed. |
| results | Managed equivalent of AnalysisData structure, used as a container for all face analysis results. |
| int _initAnalyser | ( | string | dataPath | ) |
Initialises VisageFaceAnalyser.
This function must be called before using VisageFaceAnalyser by passing it a path to the folder containing the VisageFaceAnalyser data files. Within the Visage|SDK package, this folder is Samples/data/vfa. The VisageFaceAnalyser data folder contains the following subfolders corresponding to the various types of analysis that can be performed:
An example of use:
Note that it is not necessary for all subfolders to be present, only the ones needed by the types of analysis that will be performed. For example, if only age estimation will be performed, then only the ad folder is required. The return value of the function indicates which types of analysis have been successfully initialised. Subsequent attempt to use a type of analysis that was not initialized shall fail; for example, if only ad folder was present at initialization, calling either of the analyse functions with VFAFlags.VFA_EMOTION option will result in non valid emotion estimation. The return value is a bitwise combination of flags indicating which types of analysis are successfully initialized.
Please note that in order for license to be registered, _initializeLicense() method has to be called before.
| dataPath | Relative path from the working directory to the directory that contains VisageFaceAnalyser data files (e.g. Application.streamingAssetsPath + /Visage Tracker/vfa"). |
| void _releaseAnalyser | ( | ) |
Releases memory allocated by the face analyser in the _initAnalyser() function.
This function is called after the analyser ceases to be used or before the reinitialization of the analyser.
1.8.15