Input Image

In order to use many of the Trueface AI inference functions (face detection, face recognition, etc), you must first set the image. The SDK is stateful meaning that once you set the image, it will persist until the next call to setImage is made. This means that you can set the image once then call various functions on that same image.

Once you have set the image, you are ready to start calling the various Trueface AI inference functions.

ErrorCode Trueface::SDK::setImage(std::string imageFile)

Set the image that is processed by the other methods.

Return

error code, see ErrorCode. Note, it is highly encouraged to check the return value from setImage before proceeding. If the license is invalid, the INVALID_LICENSE error will be returned.

See

setImage(uint8_t* image, uint16_t width, uint16_t height, ColorCode color, int stride)

Parameters
  • [in] imageFile: the path of a JPEG, JPG, PNG, or TIFF file (path must not contain ~ ).

ErrorCode Trueface::SDK::setImage(uint8_t *image, uint16_t width, uint16_t height, ColorCode color, int stride = 0)

Set the image that is processed by the other methods.

Return

error code, see ErrorCode. Note, it is highly encouraged to check the return value from setImage before proceeding. If the license is invalid, the INVALID_LICENSE error will be returned.

See

setImage(std::string imageFile)

Parameters
  • [in] image: an 8-bit decoded image array, in the CPU memory or the GPU memory.

  • [in] width: the image width.

  • [in] height: the image height.

  • [in] color: the image color model, see ColorCode.

  • [in] stride: the distance between image array rows in bytes, also known as step size (used only for pointers to the GPU memory).

ErrorCode Trueface::SDK::setImage(const std::vector<uint8_t> &encodedImageBuffer)

Set the image that is processed by the other methods.

Return

error code, see ErrorCode. Note, it is highly encouraged to check the return value from setImage before proceeding. If the license is invalid, the INVALID_LICENSE error will be returned.

See

setImage(std::string imageFile)

Parameters
  • [in] encodedImageBuffer: encoded image buffer, supports JPG, PNG, and TIFF.

enum Trueface::ColorCode

Image color formats

Values:

enumerator bgr
enumerator rgb
enumerator bgra
enumerator rgba
enumerator gray
enumerator yuv_i420
enumerator yuv_nv12