imgviz.label2rgb(label, image=None, alpha=0.5, label_names=None, font_size=30, thresh_suppress=0, colormap=None, loc='rb', font_path=None)[source]

Convert label to rgb.

  • label (numpy.ndarray, (H, W), int) – Label image.

  • image (numpy.ndarray, (H, W, 3), numpy.uint8) – RGB image.

  • alpha (float, or list or dict of float) – Alpha of RGB (default: 0.5). If given as a list or dict, it is treated as alpha for each class according to the index or key.

  • label_names (list or dict of string) – Label id to label name.

  • font_size (int) – Font size (default: 30).

  • thresh_suppress (float) – Threshold of label ratio in the label image.

  • colormap (numpy.ndarray, (M, 3), numpy.uint8) – Label id to color. By default, label_colormap() is used.

  • loc (string) – Location of legend (default: ‘rb’). ‘centroid’, ‘lt’ and ‘rb’ are supported.

  • font_path (str) – Font path.


res – Visualized image.

Return type:

numpy.ndarray, (H, W, 3), numpy.uint8