draw

drawing utilities.

Functions

draw_lines

Draws lines on an image.

draw_points

Draws points on an image.

draw_pose

Draws a skeleton pose on an image.

get_palette

Returns a palette of colours between [0, 1].

draw_lines(image, start_points, end_points, colors=None, thickness=3)[source]

Draws lines on an image.

Parameters:
  • image (Image)

  • start_points (ndarray) – [N, 2]

  • end_points (ndarray) – [N, 2]

  • colors (Optional[ndarray]) – [N, C]

  • thickness (int)

Return type:

Image

Returns:

draw_points(image, points, colors=None, radius=2, thickness=1)[source]

Draws points on an image.

Parameters:
  • image (Image)

  • points (ndarray) – [N, 2]

  • colors (Optional[ndarray]) – [N, C]

  • radius (int)

  • thickness (int)

Return type:

Image

Returns:

draw_pose(image, points, edges, confidences=None, circle_colors=None, circle_radius=2, circle_thickness=1, line_colors=None, line_thickness=3)[source]

Draws a skeleton pose on an image.

Parameters:
  • image (Image) – [H, W, C]

  • points (ndarray) – [N, 2]

  • confidences (Optional[ndarray]) – [N, 1]

  • edges (Tuple[Tuple[int, int], ...]) – [M, 2]

  • circle_colors (Optional[ndarray]) – [N, C]

  • circle_radius (int)

  • circle_thickness (int)

  • line_colors (Optional[ndarray]) – [M, C]

  • line_thickness (int)

Return type:

Image

Returns:

[H, W, C]

get_palette(num_colors, hue=0.01, luminance=0.6, saturation=0.65)[source]

Returns a palette of colours between [0, 1].

Parameters:
  • num_colors (int)

  • hue (float)

  • luminance (float)

  • saturation (float)

Return type:

ndarray

Returns:

[N, 3]