Visualization utilities

terran.vis

terran.vis.vis_faces(ctx, faces, scale=1.0)

Draw boxes over the detected faces for the given image.

Parameters:
  • image (np.ndarray representing an image) – Image to draw faces over.
  • faces (dict or list of dicts (from face_detection or face_tracking)) –

    Faces to draw on image. The expected format is the one returned from face_detection or face_tracking, with two optional extra fields:

    • text (str): Text to be written next to the box.
    • name (str): Name associated to the face, in order to make the color used for the box fixed.

    If available, the track field will be used as the default value for the two values above, if they aren’t specified.

Returns:

Copy of image with the faces drawn over.

Return type:

np.ndarray

terran.vis.vis_poses(ctx, poses, scale=1.0)

Draw boxes over the detected poses for the given image.

Parameters:
  • image (np.ndarray representing an image.) – Image to draw faces over.
  • poses (dict or list of dicts, as returned by pose_estimation) – Poses to draw on image. The expected format is the one returned from pose_estimation.
Returns:

Copy of image with the poses drawn over.

Return type:

np.ndarray

terran.vis.display_image(image)

Displays an image using an external viewer.

Will first try using feh, if it’s installed locally, and matplotlib as fallback, if an error occurs.

Parameters:image (np.array or PIL.Image) – Image to be displayed.
Raises:Exception – If no suitable backend is found.