lisbet.drawing#

Drawing specifications for LISBET.

Functions

color_to_bgr(color)

Convert a matplotlib color name or hex string to a BGR tuple for OpenCV.

Classes

BodySpecs(skeleton_edges[, polygons, ...])

Specification for drawing a body (skeleton, polygons, keypoints) for a given species or individual.

class lisbet.drawing.BodySpecs(skeleton_edges, polygons=<factory>, keypoint_colors=<factory>, skeleton_color='lime', skeleton_thickness=1, polygon_color='cyan', polygon_alpha=0.3, keypoint_marker='o', keypoint_size=6)[source]#

Specification for drawing a body (skeleton, polygons, keypoints) for a given species or individual.

Parameters:
  • skeleton_edges (list[tuple[str, str]]) – List of (keypoint1, keypoint2) pairs to draw as skeleton lines.

  • polygons (list[list[str]]) – List of lists of keypoint names to fill as polygons.

  • keypoint_colors (dict[str, str]) – Mapping from keypoint name to color.

  • skeleton_color (str) – Color for skeleton lines.

  • polygon_color (str) – Color for filled polygons.

  • polygon_alpha (float) – Alpha (opacity) for polygons.

  • keypoint_marker (str) – Marker style for keypoints.

  • keypoint_size (int) – Size of keypoint markers.

skeleton_edges: list[tuple[str, str]]#
polygons: list[list[str]]#
keypoint_colors: dict[str, str]#
skeleton_color: str = 'lime'#
skeleton_thickness: int = 1#
polygon_color: str = 'cyan'#
polygon_alpha: float = 0.3#
keypoint_marker: str = 'o'#
keypoint_size: int = 6#
get_keypoint_color(keypoint)[source]#

Return the color for a given keypoint, or white if not specified.

Return type:

str

__init__(skeleton_edges, polygons=<factory>, keypoint_colors=<factory>, skeleton_color='lime', skeleton_thickness=1, polygon_color='cyan', polygon_alpha=0.3, keypoint_marker='o', keypoint_size=6)#
lisbet.drawing.color_to_bgr(color)[source]#

Convert a matplotlib color name or hex string to a BGR tuple for OpenCV. Accepts color names (e.g. ‘red’), hex strings (e.g. ‘#ff0000’), or BGR tuples.