addTemplate method

void addTemplate(
  1. FaceTemplate faceTemplate,
  2. String? id
)

Adds a template to the Face Indexer. Note: This function is thread safe with other AddTemplate() calls but not with SearchTemplates() calls.

param faceTemplate Face template to add to the face indexer. param id ID of the added face template. throws FaceException An error has occurred during Face Library execution.

Implementation

void addTemplate(FaceTemplate faceTemplate, String? id) {
  Pointer<Char>? pId = id?.toNativeUtf8().cast<Char>();
  try {
    var err = faceSDK.id3FaceIndexer_AddTemplate(_pHandle.value, faceTemplate.handle, pId ?? nullptr);
    if (err != FaceError.success.value) {
      throw FaceException(err);
    }
  } finally {
    if (pId != null) {
      calloc.free(pId);
    }
  }
}