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.
-
ErrorCode Trueface::SDK::drawFaceBoxAndLandmarks(const TFImage &tfImage, const FaceBoxAndLandmarks &faceBoxAndLandmarks, bool includeLandmarks = false, const ColorRGB &color = ColorRGB(0, 255, 255), unsigned int scale = 2)¶
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
tfImage – [in] the input image on which to draw the labels.
faceBoxAndLandmarks – [in] the face to annotate.
includeLandmarks – [in] indicates if the 5 keypoint landmarks should also be drawn.
color – [in] the color to use for the annotation.
scale – [in] scale factor for the bounding box thickness. Increase scale factor for higher resolution images.
- Returns
error code, see ErrorCode.
-
ErrorCode Trueface::SDK::drawFaceLandmarks(const TFImage &tfImage, const Landmarks &landmarks, const ColorRGB &color = ColorRGB(0, 255, 255), unsigned int scale = 2)¶
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
tfImage – [in] the input image on which to draw the landmarks.
landmarks – [in] the 106 face landmarks.
color – [in] the color to use for the annotation.
scale – [in] size of the landmark points draw on the face. Increase scale factor for higher resolution images.
- Returns
error code
-
ErrorCode Trueface::SDK::drawHeadOrientationAxes(const TFImage &tfImage, const FaceBoxAndLandmarks &faceBoxAndLandmarks, float yaw, float pitch, float roll, unsigned int scale = 2)¶
Draw the 3D face orientation axes. Note, you should not run any inference functions on the image after calling this method.
- Parameters
tfImage – [in] the input image on which to draw the rotation axes.
faceBoxAndLandmarks – [in] the face for which the orientation axes will be drawn.
yaw – [in] the yaw in radians.
pitch – [in] the pitch in radians.
roll – [in] the roll in radians.
scale – [in] the scale factor for the axis line thickness and length. Increase scale factor for higher resolution images.
- Returns
error code.
-
ErrorCode Trueface::SDK::drawHeadOrientationBox(const TFImage &tfImage, const std::array<double, 3> &rotationVec, std::array<double, 3> &translationVec, unsigned int scale = 2)¶
Draw 3D box on the face. Note, you should not run any inference functions on the image after calling this method.
- Parameters
tfImage – [in] the input image on which to draw the rotation axes.
rotationVec – [in] the rotation vector, returned by estimateHeadOrientation().
translationVec – [in] the translation vector, returned by estimateHeadOrientation().
scale – [in] the scale factor for the box line thickness. Increase scale factor for higher resolution images.
- Returns
error code.
-
ErrorCode Trueface::SDK::drawCandidateBoundingBoxAndLabel(const TFImage &tfImage, const FaceBoxAndLandmarks &faceBoxAndLandmarks, const Candidate &candidate, const ColorRGB &color = ColorRGB(0, 255, 0), unsigned int scale = 2)¶
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
tfImage – [in] the input image on which to draw the labels.
faceBoxAndLandmarks – [in] the face to annotate.
candidate – [in] the candidate information.
color – [in] the color to use for the annotation.
scale – [in] the scale factor for the text size and bounding box thickness. Increase scale factor for higher resolution images.
- Returns
ErrorCode.
-
ErrorCode Trueface::SDK::drawObjectLabels(const TFImage &tfImage, const std::vector<BoundingBox> &boundingBoxes, unsigned int scale = 2)¶
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
tfImage – [in] the input image on which to draw the labels.
boundingBoxes – [in] the bounding boxes returned by detectObjects().
scale – [in] scale factor for the text size and bounding box thickness. Increase scale factor for higher resolution images.
- Returns
error code, see ErrorCode.
-
ErrorCode Trueface::SDK::drawPose(const TFImage &tfImage, const std::vector<std::vector<Landmark>> &landmarks)¶
Draw body pose on the image. Note, you should not run any inference functions on the image after calling this method.
- Parameters
tfImage – [in] the input image on which to draw the pose.
landmarks – [in] a vector of Landmark objects that represent body joints.
- Returns
error code, see ErrorCode.