|
visageSDK
|
Visage Face Analyser contains face analysis algorithms for estimating gender and emotion from frontal facial images. More...
Public Member Functions | |
| VisageFaceAnalyser () | |
| Constructor. More... | |
| VisageFaceAnalyser (String dataPath) | |
| Constructor. More... | |
| ~VisageFaceAnalyser () | |
| Destructor. More... | |
| int | Init (String dataPath) |
| Initialises VisageFaceAnalyser. More... | |
| VFAReturnCode | analyseImage (VSImage image, FaceData facedata, int options, ref AnalysisData results) |
| Performs face analysis on a given frame. More... | |
| VFAReturnCode | analyseStream (VSImage image, FaceData facedata, int options, ref AnalysisData results, int faceIndex) |
| Performs face analysis on a given image stream (video). More... | |
| void | resetStreamAnalysis (int faceIndex) |
| Resets collected face analysis data. More... | |
Visage Face Analyser contains face analysis algorithms for estimating gender and emotion from frontal facial images.
Before using VisageFaceAnalyser, it must be initialized using the function Init(). After the initialization the following types of analysis can be used:
Face analysis may be performed on an individual image, or on a sequential stream of images (such as a video or camera feed). The two corresponding functions are:
| ANALYSIS TYPE | FUNCTION |
| image analysis | analyseImage() |
| image stream (video) analysis | analyseStream() |
VisageFaceAnalyser uses VsImage structure as a container for the input image. Please refer to the VsImage structure documentation for details of accessing its data members; the basic members are the size of the image (frame->width, frame->height) and the pointer to the actual pixel data of the image (frame->imageData). All of the estimation methods expect grayscale, RGB or RGBA image. Please note that for the most efficient usage, the grayscale image format should be used. Grayscale format is a default image format for the estimation methods and conversion from other valid image formats is done internally.
Definition at line 113 of file VisageFaceAnalyser.cs.
| VisageCSWrapper.VisageFaceAnalyser.VisageFaceAnalyser | ( | ) |
Constructor.
| VisageCSWrapper.VisageFaceAnalyser.VisageFaceAnalyser | ( | String | dataPath | ) |
Constructor.
| dataPath | Relative path from the working directory to the directory that contains VisageFaceAnalyser data files. |
| VisageCSWrapper.VisageFaceAnalyser.~VisageFaceAnalyser | ( | ) |
Destructor.
| VFAReturnCode VisageCSWrapper.VisageFaceAnalyser.analyseImage | ( | VSImage | image, |
| FaceData | facedata, | ||
| int | options, | ||
| ref AnalysisData | results | ||
| ) |
Performs face analysis on a given frame.
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.
An example of use, analyseImage on all the faces detected in an image file:
| image | VsImage container that contains the input grayscale, RGB or RGBA frame. |
| facedata | FaceData obtained by a previous successful tracking (TRACK_STAT.OK) or detection operation with VisageTracker or VisageFeaturesDetector. |
| options | Bitwise combination of VFAFlags which determines the analysis operations to be performed. |
| results | AnalysisData struct containing success flags for individual operations and their assorted results. |
| VFAReturnCode VisageCSWrapper.VisageFaceAnalyser.analyseStream | ( | VSImage | image, |
| FaceData | facedata, | ||
| int | options, | ||
| ref AnalysisData | results, | ||
| int | faceIndex | ||
| ) |
Performs face analysis on a given image stream (video).
This function is primarily intended for performing face analysis on a continuous stream of related frames containing the same person, 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.
Important notes:
This method should only be called with FaceData obtained from a successful tracking operation that returned TRACK_STAT.OK tracking status.
If options parameter is changed between subsequent calls to analyseStream(), the internal state will be reset and previously collected analysis data will be lost. For optimal results options parameter should remain constant during single stream analysis session.
If a new person in the continuous stream replaces the old one, it is neccessary to call resetStreamAnalysis() method otherwise results will not be correct as analyseStream() method has no capability of differentiating faces.
An example of use, analyseImage on all the faces detected in an image file:
| image | VsImage pointer that contains the input grayscale, RGB or RGBA frame. |
| facedata | FaceData obtained by a previous successful tracking operation with VisageTracker (TRACK_STAT.OK). |
| options | Bitwise combination of VFAFlags which determines the analysis operations to be performed. |
| results | AnalysisData struct containing success flags for individual operations and their assorted results. |
| faceIndex | Index of the face for which analysis should be performed. |
| int VisageCSWrapper.VisageFaceAnalyser.Init | ( | 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. When implementing applications, developers may copy this folder as part of their application. The path is given relative to the current working directory at the time of calling the Init() function. The VisageFaceAnalyser data folder contains the following subfolders corresponding to the various types of analysis that can be performed:
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 gender estimation will be performed, then only the gd folder is required.
The return value of the Init() 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 gd folder was present at initialization, attempt to use EstimateEmotion() shall fail.
The return value is a bitwise combination of flags indicating which types of analysis are successfully initialized.
| dataPath | Relative path from the working directory to the directory that contains VisageFaceAnalyser data files. |
| void VisageCSWrapper.VisageFaceAnalyser.resetStreamAnalysis | ( | int | faceIndex | ) |
Resets collected face analysis data.
This is intended to be used in cases when a new person replaces the old one in the same continous input stream.
Erases age, gender and emotion data collected up to this point. If an index parameter is specified, only data for that specific face is erased. If no parameter is specified, data for all faces is erased.
| faceIndex | Index of the face for which AnalysisData should be reset. |
1.8.10