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 0x7fb97457f630>, 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 bytfsdk.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.
- 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 0x7fb974564430>, 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 bytfsdk.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.
- 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:
tf_image - The input
tfsdk.TFImage
, returned bytfsdk.SDK.preprocess_image()
.face_box_and_landmarks - The face for which the orientation axes will be drawn.
head_orientation - The head orientation, returned by
tfsdk.SDK.estimate_head_orientation()
.scale - Sale factor for the axis line thickness and length. Increase scale factor for higher resolution images.
- Returns:
tfsdk.ERRORCODE
- The error code.
- 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:
tf_image - The input
tfsdk.TFImage
, returned bytfsdk.SDK.preprocess_image()
.head_orientation - The head orientation, returned by
tfsdk.SDK.estimate_head_orientation()
.
- Returns:
tfsdk.ERRORCODE
- The error code.
- 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 0x7fb9745644f0>, 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 bytfsdk.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.
- 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:
tf_image - The input
tfsdk.TFImage
, returned bytfsdk.SDK.preprocess_image()
.bounding_boxes - The bounding boxes returned by
tfsdk.SDK.detect_objects()
.scale - Scale factor for the text size and bounding box thickness. Increase scale factor for higher resolution images.
- Returns:
tfsdk.ERRORCODE
- The error code.
- ColorRGB.__init__(*args, **kwargs)
Overloaded function.
__init__(self: tfsdk.ColorRGB) -> None
__init__(self: tfsdk.ColorRGB, r: int, g: int, b: int) -> None