Label

class vizdet.Label(font=<factory>, text_color=(0, 0, 0), background_color=(255, 255, 255), font_height=25, padding=5)

A class for drawing free-standing text labels.

Parameters
  • font (Font) – The font for the label. If not set, the default FiraGO font will be used.

  • text_color (Tuple[int, int, int]) – The RGB color for the text.

  • background_color (Optional[Tuple[int, int, int]]) – The RGB color for the background. If set to None, no background will be drawn.

  • font_height (int) – Height of the text of the label.

  • padding (int) – How many pixels to pad the text on all sides for the background.

Return type

None

draw(img, center_coords, text)

Draw the label on the image.

Parameters
  • img (ndarray) – The image to draw on

  • center_coords (Tuple[int, int]) – The center of the label

  • text (str) – The text (label) to draw