overlay_prediction_contours¶
- overlay_prediction_contours(canvas, inst_dict, type_colours=None, inst_colours=(255, 255, 0), line_thickness=2, *, draw_dot)[source]¶
Overlaying instance contours on image.
Internally, colours from type_colours are prioritized over inst_colours. However, if inst_colours is None and type_colours is not provided, random colour is generated for each instance.
- Parameters:
canvas (
numpy.ndarray
) – Image to draw predictions on.inst_dict (dict) – Dictionary of instances. It is expected to be in the following format: {instance_id: {type: int, contour: List[List[int]], centroid:List[float]}.
draw_dot (bool) – To draw a dot for each centroid or not.
type_colours (dict) – A dict of {type_id : (type_name, colour)}, type_id is from 0 to N and colour is a tuple of (r, g, b).
inst_colours (tuple, np.ndarray) – A colour to assign for all instances, or a list of colours to assigned for each instance in inst_dict. By default, all instances will have RGB colour (255, 255, 0).
line_thickness (int) – Line thickness of contours.
- Returns:
The overlaid image.
- Return type: