itSeez3D Avatar SDK  1.0.0
SDK for AI-powered 3D avatars creation
avatar_sdk.hpp File Reference

Go to the source code of this file.

Typedefs

typedef void(* ReportProgress) (float)
 

Functions

DllExport int initAvatarSdk (const char *programName, const char *resourcesPath)
 
DllExport int releaseAvatarSdk ()
 
DllExport AvatarSdkPipelineType getAvailablePipelineType ()
 
DllExport const char *const * getAvailableHaircutsList (unsigned int &numberOfHaircuts)
 
DllExport const char *const * getAvailableBlendshapesList (AvatarSdkPipelineType pipelineType, unsigned int &numberOfBlendshapes)
 
DllExport int generateAvatar (const AvatarSdkParams &avatarParams, ReportProgress reportProgress)
 
DllExport int generateAdditionalHaircutsFromJson (const char *avatarMeshFile, const char *outputDir, const char *resourcesJsonWithHaircuts, AvatarSdkMeshFormat format, bool saveAsPointCloud)
 
DllExport int generateAdditionalHaircutsFromList (const char *avatarMeshFile, const char *outputDir, const char *const *haircutsList, int haircutsCount, AvatarSdkMeshFormat format, bool saveAsPointCloud)
 
DllExport const float * getAvatarVertices (int &verticesCount, const char *pathToModelDir)
 
DllExport const int * getAvatarFaces (int &facesCount, const char *pathToModelDir)
 
DllExport const double * getAvatarUVMapping (int &facesCount, const char *pathToModelDir)
 
DllExport const unsigned char * getAvatarTexture (int &textureWidth, int &textureHeight, const char *pathToModelDir)
 
DllExport int getAvatarModelInfo (const char *pathToModelDir, AvatarSdkModelInfoEntry &entry)
 
DllExport AvatarSdkResourcesList getAvatarHaircutsList (const char *pathToModelDir)
 
DllExport AvatarSdkResourcesList getAvatarBlendshapesList (const char *pathToModelDir)
 
DllExport AvatarSdkResourcesList getAvatarAdditionalTextures (const char *pathToModelDir, AvatarSdkPipelineType pipelineType)
 
DllExport int getParametersJson (AvatarSdkPipelineType pipelineType, char *parametersJson, int parametersBufferSize)
 
DllExport void setResourcesPath (AvatarSdkPipelineType pipelineType, const char *resourcesPath)
 
DllExport void getLastError (char *buffer, int bufferSize)
 
DllExport void setLoggingFile (const char *logFile)
 
DllExport void setAdvancedLogs (bool isAdvanced)
 
DllExport bool isHardwareSupported ()
 

Detailed Description

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

Typedef Documentation

◆ ReportProgress

typedef void(* ReportProgress) (float)

The handler of the calculation progress.

Parameters
[in]floatThe calculation progress in percents.

Function Documentation

◆ generateAdditionalHaircutsFromJson()

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

Generates additional haircuts from the JSON for already created avatar. Works only with the FACE pipeline.

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 generateAdditionalHaircutsFromList ( const char *  avatarMeshFile,
const char *  outputDir,
const char *const *  haircutsList,
int  haircutsCount,
AvatarSdkMeshFormat  format,
bool  saveAsPointCloud 
)

Generates additional haircuts from the list for already created avatar. Works only with the FACE pipeline.

Parameters
[in]avatarMeshFilePath to the file with avatar mesh.
[in]outputDirDirectory where the generated haircuts will be saved.
[in]haircutsListArray with haircuts names that should be generated.
[in]haircutsCountNumber of haircuts in array.
[in]formatFormat of the generated haircuts.
[in]saveAsPointCloudSave haircuts as point clouds.
Returns
Zero in the successful execution.

◆ generateAvatar()

DllExport int 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: invalid license.

◆ getAvailableBlendshapesList()

DllExport const char* const* getAvailableBlendshapesList ( AvatarSdkPipelineType  pipelineType,
unsigned int &  numberOfBlendshapes 
)

Get list of available blendshapes.

Parameters
[in]pipelineTypeType of pipeline
[out]numberOfBlendshapesNumber of blendshapes in array
Returns
Constant array of available blendshapes names.

◆ getAvailableHaircutsList()

DllExport const char* const* getAvailableHaircutsList ( unsigned int &  numberOfHaircuts)

Get list of available haircuts for the Face pipeline.

Parameters
[out]numberOfHaircutsNumber of haircuts in array
Returns
Constant array of available haircuts names.

◆ getAvailablePipelineType()

DllExport AvatarSdkPipelineType getAvailablePipelineType ( )

Detects which pipeline types are available

Returns
Mask of available pipeline types.

◆ getAvatarAdditionalTextures()

DllExport AvatarSdkResourcesList getAvatarAdditionalTextures ( const char *  pathToModelDir,
AvatarSdkPipelineType  pipelineType 
)

Get additional textures for model located at specific directory.

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

◆ getAvatarBlendshapesList()

DllExport AvatarSdkResourcesList 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* getAvatarFaces ( int &  facesCount,
const char *  pathToModelDir 
)

Gets a pointer to the buffer of faces for the avatar. 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 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 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* getAvatarTexture ( int &  textureWidth,
int &  textureHeight,
const char *  pathToModelDir 
)

Gets a pointer to the RGB texture for the avatar. 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* getAvatarUVMapping ( int &  facesCount,
const char *  pathToModelDir 
)

Gets a pointer to the buffer of the uv-mapping for the avatar. 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* getAvatarVertices ( int &  verticesCount,
const char *  pathToModelDir 
)

Gets a pointer to the buffer of vertices for the avatar. 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.

◆ getLastError()

DllExport void 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 getParametersJson ( AvatarSdkPipelineType  pipelineType,
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]pipelineTypeType of avatar.
[out]parametersJsonPointer the buffer in which the JSON will be written.
[in]parametersBufferSizeSize of the buffer.
Returns
Zero if success.

◆ initAvatarSdk()

DllExport int 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 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 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 setAdvancedLogs ( bool  isAdvanced)

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

Parameters
[in]isAdvancedTrue for advanced logging.

◆ setLoggingFile()

DllExport void setLoggingFile ( const char *  logFile)

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

Parameters
[in]logFilepath to the log file.

◆ setResourcesPath()

DllExport void setResourcesPath ( AvatarSdkPipelineType  pipelineType,
const char *  resourcesPath 
)

Sets the resources location for the given pipeline type. initAvatarSdk methods sets the same path for all pipelines. Use this method if you need to set different resources locations for different pipelines.

Parameters
[in]pipelineTypeType of avatar.
[in]resourcesPathPath to resources.