Local Compute Avatar SDK  2.0.9
To generate Head 2.0 avatars
avatar_sdk.hpp File Reference

Go to the source code of this file.

Typedefs

typedef void(* avatar_sdk_2::ReportProgress) (float)
 

Functions

DllExport int avatar_sdk_2::initAvatarSdk (const char *programName, const char *resourcesPath)
 
DllExport int avatar_sdk_2::releaseAvatarSdk ()
 
DllExport const char * avatar_sdk_2::getAvailableHaircuts (AvatarSdkPipelineSubtype pipelineSubtype, unsigned int &size)
 
DllExport const char * avatar_sdk_2::getAvailableBlendshapes (AvatarSdkPipelineSubtype pipelineSubtype, unsigned int &size)
 
DllExport int avatar_sdk_2::generateAvatar (const AvatarSdkParams &avatarParams, ReportProgress reportProgress)
 
DllExport int avatar_sdk_2::generateAdditionalHaircutsFromJson (const char *avatarMeshFile, const char *outputDir, const char *resourcesJsonWithHaircuts, AvatarSdkMeshFormat format, bool saveAsPointCloud)
 
DllExport int avatar_sdk_2::generateAdditionalHaircutsFromList (const char *avatarMeshFile, const char *outputDir, const char *haircutsList, int haircutsStrSize, AvatarSdkMeshFormat format, bool saveAsPointCloud)
 
DllExport const float * avatar_sdk_2::getAvatarVertices (int &verticesCount, const char *pathToModelDir)
 
DllExport const int * avatar_sdk_2::getAvatarFaces (int &facesCount, const char *pathToModelDir)
 
DllExport const double * avatar_sdk_2::getAvatarUVMapping (int &facesCount, const char *pathToModelDir)
 
DllExport const unsigned char * avatar_sdk_2::getAvatarTexture (int &textureWidth, int &textureHeight, const char *pathToModelDir)
 
DllExport const float * avatar_sdk_2::getAvatarBlendshapeDeltas (const char *blendshapeName, int &verticesCount, const char *pathToModelDir)
 
DllExport const float * avatar_sdk_2::getHaircutVertices (int &verticesCount, const char *haircutName, const char *pathToModelDir)
 
DllExport const int * avatar_sdk_2::getHaircutFaces (int &facesCount, const char *haircutName, const char *pathToModelDir)
 
DllExport const double * avatar_sdk_2::getHaircutUVMapping (int &facesCount, const char *haircutName, const char *pathToModelDir)
 
DllExport const unsigned char * avatar_sdk_2::getHaircutTexture (int &textureWidth, int &textureHeight, const char *haircutName, const char *pathToModelDir)
 
DllExport int avatar_sdk_2::getAvatarModelInfo (const char *pathToModelDir, AvatarSdkModelInfoEntry &entry)
 
DllExport AvatarSdkResourcesList avatar_sdk_2::getAvatarHaircutsList (const char *pathToModelDir)
 
DllExport AvatarSdkResourcesList avatar_sdk_2::getAvatarBlendshapesList (const char *pathToModelDir)
 
DllExport AvatarSdkResourcesList avatar_sdk_2::getAvatarAdditionalTextures (const char *pathToModelDir, AvatarSdkPipelineSubtype pipelineSubtype)
 
DllExport int avatar_sdk_2::getParametersJson (AvatarSdkPipelineSubtype pipelineSubtype, char *parametersJson, int parametersBufferSize)
 
DllExport void avatar_sdk_2::getLastError (char *buffer, int bufferSize)
 
DllExport void avatar_sdk_2::setLoggingFile (const char *logFile)
 
DllExport void avatar_sdk_2::setAdvancedLogs (bool isAdvanced)
 
DllExport bool avatar_sdk_2::isHardwareSupported ()
 

Detailed Description

This file contains public methods of the itSeez3D Offline Avatar SDK.

Definition in file avatar_sdk.hpp.

Typedef Documentation

◆ ReportProgress

typedef void(* avatar_sdk_2::ReportProgress) (float)

The handler of the calculation progress.

Parameters
[in]floatThe calculation progress in percents.

Definition at line 25 of file avatar_sdk.hpp.

Function Documentation

◆ generateAdditionalHaircutsFromJson()

DllExport int avatar_sdk_2::generateAdditionalHaircutsFromJson ( const char *  avatarMeshFile,
const char *  outputDir,
const char *  resourcesJsonWithHaircuts,
AvatarSdkMeshFormat  format,
bool  saveAsPointCloud 
)

Generates additional haircuts from the JSON for already created avatar. Does not work for avatar 'base/generated' haircut.

Parameters
[in]avatarMeshFilePath to the file with avatar mesh.
[in]outputDirDirectory where the generated haircuts will be saved.
[in]resourcesJsonWithHaircutsPointer to the resources JSON that contains haircuts list.
[in]formatFormat of the generated haircuts.
[in]saveAsPointCloudSave haircuts as point clouds.
Returns
Zero in the successful execution.

◆ generateAdditionalHaircutsFromList()

DllExport int avatar_sdk_2::generateAdditionalHaircutsFromList ( const char *  avatarMeshFile,
const char *  outputDir,
const char *  haircutsList,
int  haircutsStrSize,
AvatarSdkMeshFormat  format,
bool  saveAsPointCloud 
)

Generates additional haircuts from the list for already created avatar. Does not work for avatar 'base/generated' haircut.

Parameters
[in]avatarMeshFilePath to the file with avatar mesh in PLY or OBJ format.
[in]outputDirDirectory where the generated haircuts will be saved.
[in]haircutsListHaircuts names separated by ';'.
[in]haircutsStrSizeLength of the haircutsList string.
[in]formatFormat of the generated haircuts.
[in]saveAsPointCloudSave haircuts as point clouds.
Returns
Zero in the successful execution.

◆ generateAvatar()

DllExport int avatar_sdk_2::generateAvatar ( const AvatarSdkParams avatarParams,
ReportProgress  reportProgress 
)

Generates an avatar with the given params. The avatar will be stored in memory if the outputDirPath isn't specified. Only one avatar can be genearted at a time.

Parameters
[in]avatarParamsGeneration parameters.
[in]reportProgressCallback that is invoked when the calculation progress is changed.
Returns
Zero in the successful execution. 13: in case the input image can't be read. 26: the face isn't detected on the provided image. -3: exception occured. Use getLastError method to get more info. -4: license error. Use getLastError method to get more info.

◆ getAvailableBlendshapes()

DllExport const char* avatar_sdk_2::getAvailableBlendshapes ( AvatarSdkPipelineSubtype  pipelineSubtype,
unsigned int &  size 
)

Get available blendshapes

Parameters
[in]pipelineSubtypeSubtype of pipeline.
[out]sizeNumber of symbols in list
Returns
Pointer to the blendshapes sets names separated by the ';'.

◆ getAvailableHaircuts()

DllExport const char* avatar_sdk_2::getAvailableHaircuts ( AvatarSdkPipelineSubtype  pipelineSubtype,
unsigned int &  size 
)

Get available haircuts

Parameters
[in]pipelineSubtypeSubtype of pipeline.
[out]sizeNumber of symbols in list
Returns
Pointer to the haircuts names separated by the ';'.

◆ getAvatarAdditionalTextures()

DllExport AvatarSdkResourcesList avatar_sdk_2::getAvatarAdditionalTextures ( const char *  pathToModelDir,
AvatarSdkPipelineSubtype  pipelineSubtype 
)

Get additional textures for model located at specific directory.

Parameters
[in]pathToModelDirPath to model directory
[in]pipelineSubtypeSubtype of pipeline
Returns
Collection of additional textures names and corresponding filenames.

◆ getAvatarBlendshapeDeltas()

DllExport const float* avatar_sdk_2::getAvatarBlendshapeDeltas ( const char *  blendshapeName,
int &  verticesCount,
const char *  pathToModelDir 
)

Gets a pointer to the buffer of blendshape deltas for the avatar. Blendshape deltas can be returned for the avatar in PLY or OBJ format. If pathToModelDir was not specified, the deltas will be returned for the latest generated avatar that stored in memory. The deltas buffer is a raw float values with 3 floats per vertex.

Parameters
[in]blendshapeNameName of blendshape. "jawOpen" for example.
[out]verticesCountVertices count.
[in]pathToModelDirPath to directory where model is located.
Returns
Vertices buffer pointer.

◆ getAvatarBlendshapesList()

DllExport AvatarSdkResourcesList avatar_sdk_2::getAvatarBlendshapesList ( const char *  pathToModelDir)

Get blendshapes for model located at specific directory.

Parameters
[in]pathToModelDirPath to model directory
Returns
Collection of blendshapes names and corresponding filenames.

◆ getAvatarFaces()

DllExport const int* avatar_sdk_2::getAvatarFaces ( int &  facesCount,
const char *  pathToModelDir 
)

Gets a pointer to the buffer of faces for the avatar. Data can be returned for the avatar in PLY or OBJ format. If pathToModelDir was not specified, the vertices will be returned for the latest generated avatar that stored in memory. The faces buffer is a raw int values (vertex indices). Each face consists from the three vertices.

Parameters
[out]facesCountFaces count.
[in]pathToModelDirPath to directory where model is located.
Returns
Faces buffer pointer.

◆ getAvatarHaircutsList()

DllExport AvatarSdkResourcesList avatar_sdk_2::getAvatarHaircutsList ( const char *  pathToModelDir)

Get haircuts for model located at specific directory.

Parameters
[in]pathToModelDirPath to model directory
Returns
Collection of haircuts names and corresponding filenames.

◆ getAvatarModelInfo()

DllExport int avatar_sdk_2::getAvatarModelInfo ( const char *  pathToModelDir,
AvatarSdkModelInfoEntry entry 
)

Reads model information and fills appropriate structure with data read.

Parameters
[in]pathToModelDirPath to directory where model is located.
[out]entryModel information structure.
Returns
Zero in the successful execution.

◆ getAvatarTexture()

DllExport const unsigned char* avatar_sdk_2::getAvatarTexture ( int &  textureWidth,
int &  textureHeight,
const char *  pathToModelDir 
)

Gets a pointer to the RGB texture for the avatar. Data can be returned for the avatar in PLY or OBJ format. If pathToModelDir was not specified, the vertices will be returned for the latest generated avatar that stored in memory. RGB values are stored as 3 channels of unsigned char data.

Parameters
[out]textureWidthTexture width.
[out]textureHeightTexture height.
[in]pathToModelDirPath to directory where model is located.
Returns
RGB texture data pointer.

◆ getAvatarUVMapping()

DllExport const double* avatar_sdk_2::getAvatarUVMapping ( int &  facesCount,
const char *  pathToModelDir 
)

Gets a pointer to the buffer of the uv-mapping for the avatar. Data can be returned for the avatar in PLY or OBJ format. If pathToModelDir was not specified, the vertices will be returned for the latest generated avatar that stored in memory. The uv-mapping is available only in case the outputDirPath was not specified. The uv-mapping buffer is a raw double values of the UV texture coordinates of the vertices in the faces. So if the total number of the faces is N, then the size of the uv-mapping buffer is M = N * 3 * 2. (number 3 means vertices per faces, number 2 means U and V coordinates for each vertex)

Parameters
[out]facesCountFaces count.
[in]pathToModelDirPath to directory where model is located.
Returns
uv-mapping buffer pointer.

◆ getAvatarVertices()

DllExport const float* avatar_sdk_2::getAvatarVertices ( int &  verticesCount,
const char *  pathToModelDir 
)

Gets a pointer to the buffer of vertices for the avatar. Data can be returned for the avatar in PLY or OBJ format. If pathToModelDir was not specified, the vertices will be returned for the latest generated avatar that stored in memory. The vertices buffer is a raw float values with 3 floats per vertex.

Parameters
[out]verticesCountVertices count.
[in]pathToModelDirPath to directory where model is located.
Returns
Vertices buffer pointer.

◆ getHaircutFaces()

DllExport const int* avatar_sdk_2::getHaircutFaces ( int &  facesCount,
const char *  haircutName,
const char *  pathToModelDir 
)

Gets a pointer to the buffer of faces for the haircut. If pathToModelDir was not specified, an attemp to find data among saved in memory haircuts will be performed. Haircuts are saved in memory during avatar generation. The faces buffer is a raw int values (vertex indices). Each face consists from the three vertices.

Parameters
[out]facesCountFaces count.
[in]haircutNameName of haircut.
[in]pathToModelDirPath to directory where model is located.
Returns
Faces buffer pointer.

◆ getHaircutTexture()

DllExport const unsigned char* avatar_sdk_2::getHaircutTexture ( int &  textureWidth,
int &  textureHeight,
const char *  haircutName,
const char *  pathToModelDir 
)

Gets a pointer to the RGB texture for the avatar. If pathToModelDir was not specified, an attemp to find data among saved in memory haircuts will be performed. Haircuts are saved in memory during avatar generation. RGB values are stored as 3 channels of unsigned char data.

Parameters
[out]textureWidthTexture width.
[out]textureHeightTexture height.
[in]pathToModelDirPath to directory where model is located.
Returns
RGB texture data pointer.

◆ getHaircutUVMapping()

DllExport const double* avatar_sdk_2::getHaircutUVMapping ( int &  facesCount,
const char *  haircutName,
const char *  pathToModelDir 
)

Gets a pointer to the buffer of the uv-mapping for the haircut. If pathToModelDir was not specified, an attemp to find data among saved in memory haircuts will be performed. Haircuts are saved in memory during avatar generation. The uv-mapping is available only in case the outputDirPath was not specified. The uv-mapping buffer is a raw double values of the UV texture coordinates of the vertices in the faces. So if the total number of the faces is N, then the size of the uv-mapping buffer is M = N * 3 * 2. (number 3 means vertices per faces, number 2 means U and V coordinates for each vertex)

Parameters
[out]facesCountFaces count.
[in]haircutNameName of haircut.
[in]pathToModelDirPath to directory where model is located.
Returns
uv-mapping buffer pointer.

◆ getHaircutVertices()

DllExport const float* avatar_sdk_2::getHaircutVertices ( int &  verticesCount,
const char *  haircutName,
const char *  pathToModelDir 
)

Gets a pointer to the buffer of vertices for the haircut. If pathToModelDir was not specified, an attemp to find data among saved in memory haircuts will be performed. Haircuts are saved in memory during avatar generation. The vertices buffer is a raw float values with 3 floats per vertex.

Parameters
[out]verticesCountVertices count.
[in]haircutNameName of haircut.
[in]pathToModelDirPath to directory where model is located.
Returns
Vertices buffer pointer.

◆ getLastError()

DllExport void avatar_sdk_2::getLastError ( char *  buffer,
int  bufferSize 
)

Returns the description of the latest error.

Parameters
[out]bufferPointer to the buffer where the message will be written.
[in]bufferSizeSize of the buffer.

◆ getParametersJson()

DllExport int avatar_sdk_2::getParametersJson ( AvatarSdkPipelineSubtype  pipelineSubtype,
char *  parametersJson,
int  parametersBufferSize 
)

Gets the JSON with all available parameters. You could modify this JSON and set the AvatarSdkParams.resourcesJson to configure some specific parameters.

Parameters
[in]pipelineSubtypeType of avatar.
[out]parametersJsonPointer the buffer in which the JSON will be written.
[in]parametersBufferSizeSize of the buffer.
Returns
Length of the json string.

◆ initAvatarSdk()

DllExport int avatar_sdk_2::initAvatarSdk ( const char *  programName,
const char *  resourcesPath 
)

Initializes the Avatar SDK. Should be called once before any other methods.

Parameters
[in]programNameName of your application.
[in]resourcesPathPath to the resources.
Returns
Zero in the successful execution.

◆ isHardwareSupported()

DllExport bool avatar_sdk_2::isHardwareSupported ( )

Check if the avatar can be generated with this hardware configuration. Windows requirements: CPU must support AVX extensions set.

Returns
True if supported.

◆ releaseAvatarSdk()

DllExport int avatar_sdk_2::releaseAvatarSdk ( )

Deinitializes the Avatar SDK and releases available resources. Should be called before the app terminates.

Returns
Zero in the successful execution.

◆ setAdvancedLogs()

DllExport void avatar_sdk_2::setAdvancedLogs ( bool  isAdvanced)

Configures if the advanced (more detailed) logs are written.

Parameters
[in]isAdvancedTrue for advanced logging.

◆ setLoggingFile()

DllExport void avatar_sdk_2::setLoggingFile ( const char *  logFile)

Set the logs file. By default logs are not written to file.

Parameters
[in]logFilepath to the log file.