Standalone Template From Image
C API for generating a VFace template from an image. Exposed alongside the Biomatch API in libvface_biomatch.so. See biomatch_extra_api.h in your code distribution.
Please consult the documentation for your programming environment of choice to see how to call a C API from your program. For example, P/Invoke in C#, and JNI in Java.
Veridium has examples available for calling this API from C++ (in the implementation of a gRPC microservice) and Ruby (in the implmentation of a HTTP REST API).
Function signature
int vface_template_from_image(const void* image_data, size_t image_data_size, int template_flags,
void** out_template, size_t* out_template_size,
void* (*allocator)(size_t));
Parameters
image_data
,image_size
- pointer to and size of (respectively) a byte array containing a colour image encoded as a PNG or JPEG.template_flags
- Either1
if the resulting template is to be used in an "enrol" role, or2
if it is to be used in an "auth" role.out_template
,out_template_size
- if the operation is successful, the values pointed to by these parameters are filled in with a pointer to, and the size of, a byte array containing the output template. The byte array is allocated with the allocator function passed to theallocator
parameter, and ownership is passed to the caller.allocator
- an allocation function. Defaults tomalloc
if a null pointer is passed.
Return value
0 if successful, non-zero otherwise.
Code | Description |
---|---|
0x0100 - 0x01FF | Image decode failure |
0x0101 | Image pointer was null |
0x0102 | Image data couldn't be decoded |
0x0103 | An exception was thrown while decoding an image |
0x0104 | Image data had zero size |
0x0200 - 0x02FF | Create template failure |
0x0201 | Must be enroll or auth |
0x0202 | Cannot be interactive mode |
0x0203 | Cannot use liveness |
0x0204 | No face found |
0x0205 | Failed quality check |
0x0206 | Unsupported on current platform |
0x0207 | Library not initialised |
0x0208 | Unhandled exception |
0x0209 | Invalid extractor state |
0x0300 | Output pointer is null |
If you have a persistent issue with errors being generated, please contact Veridium. Further information about failures may be printed to standard error.