expressed/v_dl/sdk/doc/VisageFaceAnalyser.html

914 lines
20 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: VisageFaceAnalyser</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: VisageFaceAnalyser</h1>
<section>
<header>
<h2>
VisageFaceAnalyser
</h2>
</header>
<article>
<div class="container-overview">
<dt>
<h4 class="name" id="VisageFaceAnalyser"><span class="type-signature"></span>new VisageFaceAnalyser<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
VisageFaceAnalyser contains face analysis algorithms capable of estimating age, gender, and emotion from facial images.
<br/><br/>
Following types of analysis can be used:
<br/><br/>
<table>
<tr><td width="250"><b>ANALYSIS TYPE</b></td><td width="200"><b>FUNCTION</b></td></tr>
<tr><td>image analysis</td><td><a href="VisageFaceAnalyser.html#analyseImage">analyseImage()</a></td></tr>
<tr><td>image stream (video) analysis</td><td><a href="VisageFaceAnalyser.html#analyseStream">analyseStream()</a></td></tr>
</table>
<br/><br/>
Age, gender and emotion analysis is based on the <a href="FaceData.html">FaceData</a> obtained from the
<a href="VisageTracker.html">VisageTracker</a> or <a href="VisageDetector.html">VisageDetector</a> API.
<br/><br/>
<b>Note</b>: After the end of use VisageFaceAnalyser object needs to be deleted to release the allocated memory. Example:
<pre class="prettyprint source"><code>
&lt;script>
m_FaceAnalyser = new VisageModule.VisageFaceAnalyser();
...
m_FaceAnalyser.delete();
&lt;/script>
</code></pre>
<br/><br/>
<h5>Dependencies</h5>
<br/>
VisageFaceAnalyser requires algorithm data file, neural network configuration file and license key file
to be preloaded to virtual file system. Data and neural network configuration file can be found in the <i>www/lib</i> folder.
<br/><br/>
<h6>Data files</h6>
An external loader script <b>visageAnalysisData.js</b> is provided for preloading the <b>visageAnalysisData.data</b> file.
<br/><br/>
<u id="changeLocation"><i>Changing the location of data files</u></i>
<br/>
By default, loader scripts expect the <b>.data</b> files to be in the same location as <b>the application's main html file</b>,
while <b>visageSDK.wasm</b> is expected to be in the same location as <b>visageSDK.js</b> library file.
However, location of the <i>.data</i> and <i>.wasm</i> files can be changed.
<br/>
The code example below shows how to implement <i>locateFile</i> function and how to set it as an attribute to the VisageModule object.
<br/><br/>
<h6>Configuration file and license key files</h6>
Configuration file and the license key files are preloaded using VisageModule's API function assigned to the <i>preRun</i> attribute:
<pre><code>
VisageModule.FS_createPreloadedFile(parent, name, url, canRead, canWrite)
</code></pre>
where <i>parent</i> and <i>name</i> are the path on the virtual file system and the name of the file, respectively.
</br></br>
</br></br>
<h5>visage|SDK initialization order</h5>
<br/>
The order in which the VisageModule is declared and library and data scripts are included is important.
<br/>
<ul>
<li> First, <b>VisageModule</b> object is declared
<ul>
<li> including preloading of the configuration files, license files and possibly, changing the location of data files
</ul>
<li> then <b>visageSDK.js</b> library script is included and
<li> last, <b>visageAnalysisData.js</b> external data loader script is included
</ul>
<br/><br/>
Sample usage - changing data files location and script including order:
<br/>
<pre class="prettyprint source"><code>
&lt;script>
licenseName = "lic_web.vlc"
licenseURL = "lic_web.vlc"
var locateFile = function(dataFileName) {var relativePath = "../../lib/" + dataFileName; return relativePath};
VisageModule = {
locateFile: locateFile,
preRun: [function() {
VisageModule.FS_createPreloadedFile('/', 'NeuralNet.cfg', "../../lib/NeuralNet.cfg", true, false);
VisageModule.FS_createPreloadedFile('/', 'Head Tracker.cfg', "../../lib/Head Tracker.cfg", true, false);
VisageModule.FS_createPreloadedFile('/', licenseName, licenseURL, true, false, function(){ }, function(){ alert("Loading License Failed!") });
}],
onRuntimeInitialized: onModuleInitialized
}
&lt;/script>
&lt;script src="../../lib/visageSDK.js"> &lt;/script>
&lt;script src="../../lib/visageAnalysisData.js"> &lt;/script>
</code></pre>
<br/>
<br/><br/>
</div>
<dl class="details">
</dl>
</dd>
</div>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="analyseImage"><span class="type-signature"></span>analyseImage<span class="signature">(frameWidth, frameHeight, p_imageData, faceData, options, results)</span><span class="type-signature"> &rarr; {<a href="global.html#VFAReturnCode">VFAReturnCode</a>}</span></h4>
</dt>
<dd>
<div class="description">
Performs face analysis on a given image.
<br/><br/>
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.
<br/><br/>
<b>Note:</b> Prior to using this function, it is necessary to
process the facial image or video frame using <a href="VisageTracker.html">VisageTracker</a>
or <a href="VisageDetector.html">VisageDetector</a> and pass the frame and obtained data to this function.
This function estimates gender, age, and/or emotions for the last image processed by <a href="VisageTracker.html#track">VisageTracker.track()</a> or <a href="VisageDetector.html#detectFeatures">VisageDetector.detectFeatures()</a> function.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>frameWidth</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">Width of the frame</td>
</tr>
<tr>
<td class="name"><code>frameHeight</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">Height of the frame</td>
</tr>
<tr>
<td class="name"><code>p_imageData</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">Pointer to image pixel data, size of the array must correspond to frameWidth and frameHeight.</td>
</tr>
<tr>
<td class="name"><code>faceData</code></td>
<td class="type">
<span class="param-type"><a href="FaceData.html">FaceData</a></span>
</td>
<td class="description last">FaceData object filled with tracking results from a previous call of the <a href="VisageTracker.html#track">VisageTracker.track()</a> or
<a href="VisageDetector.html#detectFeatures">VisageDetector.detectFeatures()</a> function.</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">Bitwise combination of <a href="global.html#VFAFlags">VFAFlags</a> which determines the analysis operations to be performed.</td>
</tr>
<tr>
<td class="name"><code>results</code></td>
<td class="type">
<span class="param-type"><a href="AnalysisData.html">AnalysisData</a></span>
</td>
<td class="description last">AnalysisData struct containing success flags for individual operations and their assorted results</td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Value indicating the status of the performed analysis.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="global.html#VFAReturnCode">VFAReturnCode</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="analyseStream"><span class="type-signature"></span>analyseStream<span class="signature">(frameWidth, frameHeight, p_imageData, faceData, options, results, faceIndex)</span><span class="type-signature"> &rarr; {<a href="global.html#VFAReturnCode">VFAReturnCode</a>}</span></h4>
</dt>
<dd>
<div class="description">
Performs face analysis on a given image stream (video).
<br/><br/>
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.
<br/><br/>
<b>Important note:</b><br>
If <i>options</i> 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 <i>options</i> parameter should remain constant during single stream analysis session.
<br/><br/>
<b>Note:</b> Prior to using this function, it is necessary to process the facial image or video frame using
<a href="VisageTracker.html">VisageTracker</a> and pass the frame and obtained data to this function.
This function estimates gender, age, and/or emotions for the last image processed by <a href="VisageTracker.html#track">VisageTracker.track()</a>
function.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>frameWidth</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">Width of the frame</td>
</tr>
<tr>
<td class="name"><code>frameHeight</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">Height of the frame</td>
</tr>
<tr>
<td class="name"><code>p_imageData</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">Pointer to image pixel data, size of the array must correspond to frameWidth and frameHeight.</td>
</tr>
<tr>
<td class="name"><code>faceData</code></td>
<td class="type">
<span class="param-type"><a href="FaceData.html">FaceData</a></span>
</td>
<td class="description last">FaceData object filled with tracking results from a previous call of the <a href="VisageTracker.html#track">VisageTracker.track()</a> function.</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">Bitwise combination of <a href="global.html#VFAFlags">VFAFlags</a> which determines the analysis operations to be performed.</td>
</tr>
<tr>
<td class="name"><code>results</code></td>
<td class="type">
<span class="param-type"><a href="AnalysisData.html">AnalysisData</a></span>
</td>
<td class="description last">AnalysisData struct containing success flags for individual operations and their assorted results</td>
</tr>
<tr>
<td class="name"><code>faceIndex</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">Index of the face for which analysis should be performed.</td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Value indicating the status of the performed analysis.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="global.html#VFAReturnCode">VFAReturnCode</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="resetStreamAnalysis"><span class="type-signature"></span>resetStreamAnalysis<span class="signature">(<span class="optional">faceIndex</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Resets collected face analysis data.
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.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>faceIndex</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">Index of the face for which analysis data should be reset</td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-VisageTrackerUnityPlugin.html">VisageTrackerUnityPlugin</a></li><li><a href="module-VisageAnalyserUnityPlugin.html">VisageAnalyserUnityPlugin</a></li></ul><h3>Classes</h3><ul><li><a href="FaceData.html">FaceData</a></li><li><a href="ScreenSpaceGazeData.html">ScreenSpaceGazeData</a></li><li><a href="VectorFloat.html">VectorFloat</a></li><li><a href="VectorShort.html">VectorShort</a></li><li><a href="VectorString.html">VectorString</a></li><li><a href="VisageFaceAnalyser.html">VisageFaceAnalyser</a></li><li><a href="AnalysisData.html">AnalysisData</a></li><li><a href="FeaturePoint.html">FeaturePoint</a></li><li><a href="FDP.html">FDP</a></li><li><a href="VisageDetector.html">VisageDetector</a></li><li><a href="FaceDataVector.html">FaceDataVector</a></li><li><a href="VSRectVector.html">VSRectVector</a></li><li><a href="VSRect.html">VSRect</a></li><li><a href="VisageGazeTracker.html">VisageGazeTracker</a></li><li><a href="VisageFaceRecognition.html">VisageFaceRecognition</a></li><li><a href="VisageTracker.html">VisageTracker</a></li><li><a href="VisageConfiguration.html">VisageConfiguration</a></li><li><a href="VisageLivenessBlink.html">VisageLivenessBlink</a></li><li><a href="VisageLivenessSmile.html">VisageLivenessSmile</a></li><li><a href="VisageLivenessBrowRaise.html">VisageLivenessBrowRaise</a></li><li><a href="VisageAR.html">VisageAR</a></li></ul><h3>Global</h3><ul><li><a href="global.html#FP_START_GROUP_INDEX">FP_START_GROUP_INDEX</a></li><li><a href="global.html#FP_END_GROUP_INDEX">FP_END_GROUP_INDEX</a></li><li><a href="global.html#FP_NUMBER_OF_GROUPS">FP_NUMBER_OF_GROUPS</a></li><li><a href="global.html#initializeLicenseManager">initializeLicenseManager</a></li><li><a href="global.html#VisageTrackerStatus">VisageTrackerStatus</a></li><li><a href="global.html#VisageTrackerImageFormat">VisageTrackerImageFormat</a></li><li><a href="global.html#VisageTrackerOrigin">VisageTrackerOrigin</a></li><li><a href="global.html#getSDKVersion">getSDKVersion</a></li></ul>
</nav>
<br clear="both">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.0</a> on Sat Jul 29 2023 01:38:28 GMT-0000 (GMT)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>