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(const std::string &imageFile)¶
Set the image that is processed by the other methods.
- See
setImage(uint8_t* image, uint16_t width, uint16_t height, ColorCode color, int stride)
- Parameters
imageFile – [in] the path of a JPEG, JPG, PNG, BMP, or TIFF file (path must not contain ~ ).
- Returns
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.
-
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.
- See
setImage(std::string imageFile)
- Parameters
image – [in] an 8-bit decoded image array, in the CPU memory or the GPU memory.
width – [in] the image width.
height – [in] the image height.
color – [in] the image color model, see ColorCode.
stride – [in] the distance between image array rows in bytes, also known as step size (used only for pointers to the GPU memory).
- Returns
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.
-
ErrorCode Trueface::SDK::setImage(const std::vector<uint8_t> &encodedImageBuffer)¶
Set the image that is processed by the other methods.
- See
setImage(std::string imageFile)
- Parameters
encodedImageBuffer – [in] encoded image buffer, supports JPG, PNG, BMP, and TIFF.
- Returns
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.
-
void Trueface::SDK::getImageProperties(ImageProperties &imageProperties)¶
Get properties of the image set by setImage().
- Parameters
imageProperties – [out] the image properties
-
enum Trueface::ColorCode¶
Image color formats
Values:
-
enumerator bgr¶
-
enumerator rgb¶
-
enumerator bgra¶
-
enumerator rgba¶
-
enumerator gray¶
-
enumerator yuv_i420¶
-
enumerator yuv_nv12¶
-
enumerator bgr¶
-
struct Trueface::ImageProperties¶
The image properties.