Input Image

SDK.set_image(*args, **kwargs)

Overloaded function.

  1. set_image(self: tfsdk.SDK, pixel_array: numpy.ndarray[uint8], width: int, height: int, color_code: Trueface::ColorCode) -> Trueface::ErrorCode

Load an image from the given pixel array in memory. 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.

  1. set_image(self: tfsdk.SDK, jpeg_filepath: str) -> Trueface::ErrorCode

Load an image from the given JPEG or PNG file path.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.

You can set the image using an OpenCV cv::Mat by passing the image buffer as follows:

1
2
 cv_img = cv2.imread(img_path)
 res = sdk.set_image(cv_img, cv_img.shape[1], cv_img.shape[0], tfsdk.COLORCODE.bgr)
class tfsdk.COLORCODE

Members:

bgr

rgb

bgra

rgba

gray

yuv_i420

yuv_nv12