Image Annotation

Methods for annotating images with face landmarks, bounding boxes, face recognition labels, and more. After annotating an image, you must not run inference functions on that image. You can call multiple annotation methods on the same image.

SDK.draw_face_box_and_landmarks(self: tfsdk.SDK, tf_image: tfsdk.TFImage, face_box_and_landmarks: tfsdk.FaceBoxAndLandmarks, include_landmarks: bool = False, color: tfsdk.ColorRGB = <tfsdk.ColorRGB object at 0x7f5945091930>, scale: int = 2) tfsdk.ERRORCODE

Draw face detection bounding box and 5 keypoint landmarks. Note, you should not run any inference functions on the image after calling this method.

Parameters:
  • tf_image - The input tfsdk.TFImage, returned by tfsdk.SDK.preprocess_image().

  • face_box_and_landmarks - The face to annotate.

  • include_landmarks - Indicates if the 5 keypoint landmarks should also be drawn.

  • color - The color to use for the annotation (default = ColorRGB(0, 255, 255).

  • Scale - Scale factor for the bounding box thickness. Increase scale factor for higher resolution images.

Returns:

tfsdk.ERRORCODE - The error code.

_images/face_box_and_landmarks_demo.gif
SDK.draw_face_landmarks(self: tfsdk.SDK, tf_image: tfsdk.TFImage, landmarks: Annotated[List[tfsdk.Point], FixedSize(106)], color: tfsdk.ColorRGB = <tfsdk.ColorRGB object at 0x7f59450d87f0>, scale: int = 2) tfsdk.ERRORCODE

Draw the 106 face landmarks on the face image. Note, you should not run any inference functions on the image after calling this method.

Parameters:
  • tf_image - The input tfsdk.TFImage, returned by tfsdk.SDK.preprocess_image().

  • landmarks - The 106 face landmarks.

  • color - The color to use for the annotation (default = ColorRGB(0, 255, 255).

  • scale - Size of the landmark points draw on the face. Increase scale factor for higher resolution images.

Returns:

tfsdk.ERRORCODE - The error code.

_images/face_landmarks_demo.gif
SDK.draw_head_orientation_axes(self: tfsdk.SDK, tf_image: tfsdk.TFImage, face_box_and_landmarks: tfsdk.FaceBoxAndLandmarks, head_orientation: tfsdk.HeadOrientation, scale: int = 2) tfsdk.ERRORCODE

Draw the 3D face orientation axes. Note, you should not run any inference functions on the image after calling this method.

Parameters:
Returns:

tfsdk.ERRORCODE - The error code.

_images/face_pose_axes_demo.gif
SDK.draw_head_orientation_box(self: tfsdk.SDK, tf_image: tfsdk.TFImage, head_orientation: tfsdk.HeadOrientation, scale: int = 2) tfsdk.ERRORCODE

Draw 3D box on the face. Note, you should not run any inference functions on the image after calling this method.

Parameters:
Returns:

tfsdk.ERRORCODE - The error code.

_images/face_pose_box_demo.gif
SDK.draw_candidate_bounding_box_and_label(self: tfsdk.SDK, tf_image: tfsdk.TFImage, face_box_and_landmarks: tfsdk.FaceBoxAndLandmarks, candidate: tfsdk.Candidate, color: tfsdk.ColorRGB = <tfsdk.ColorRGB object at 0x7f594509b6f0>, scale: int = 2) tfsdk.ERRORCODE

Draw a bounding box around the face and a label containing the identity and match probability. Note, you should not run any inference functions on the image after calling this method.

Parameters:
  • tf_image - The input tfsdk.TFImage, returned by tfsdk.SDK.preprocess_image().

  • face_box_and_landmarks - The face to annotate.

  • candidate - The candidate information.

  • color - The color to use for the annotation (default = ColorRGB(255, 255, 255).

  • scale - Scale factor for the bounding box thickness. Increase scale factor for higher resolution images.

Returns:

tfsdk.ERRORCODE - The error code.

_images/face_recognition_demo.gif
SDK.draw_object_labels(self: tfsdk.SDK, tf_image: tfsdk.TFImage, bounding_boxes: List[tfsdk.BoundingBox], scale: int = 2) tfsdk.ERRORCODE

Draw object detector bounding boxes and labels on the image. Note, you should not run any inference functions on the image after calling this method.

Parameters:
Returns:

tfsdk.ERRORCODE - The error code.

class tfsdk.ColorRGB
property b

Blue channel.

property g

Green channel.

property r

Red channel.

ColorRGB.__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: tfsdk.ColorRGB) -> None

  2. __init__(self: tfsdk.ColorRGB, r: int, g: int, b: int) -> None