Overview
Simple and efficient bounding box visualization for object detection results. Automatically adapts line thickness based on image dimensions for optimal visibility.Function Signature
Parameters
Input image to draw boxes on (BGR format). Modified in-place with drawn bounding boxes.
Detections object containing bounding boxes. Each detection must have a ‘bbox’ attribute with (x1, y1, x2, y2) coordinates.
Line thickness for bounding boxes in pixels. If None, automatically determined based on image size.
List of BGR color tuples to override default colors. Colors are mapped to unique class_ids in order of appearance. If None, uses default ColorManager colors.
Returns
Image with bounding boxes drawn. The input image is modified in-place.
Examples
Error Handling
This function may raise the following exceptions:
- AttributeError: If detection objects lack required ‘bbox’ attribute.
- ValueError: If bounding box coordinates are invalid or out of bounds.
Notes
- Input image is modified in-place for memory efficiency
- Thickness automatically adapts to image dimensions when not specified
- Coordinates are automatically converted to integers for drawing
- Color selection uses ColorManager for consistent visualization across detections