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, pointer: int, width: int, height: int, color_code: Trueface::ColorCode, stride: int) -> Trueface::ErrorCode

Load an image from the given memory pointer. 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, image_filepath: str) -> Trueface::ErrorCode

Load an image from the given JPEG, JPG, PNG, or TIFF file (path must not contain ~ ).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, encodedImageBuffer: List[int]) -> Trueface::ErrorCode

Load an image from an encoded image buffer, supports JPG, PNG, and TIFF.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