Skip to content

Drawing

powerboxes.draw_boxes(image, boxes, colors=None, thickness=2)

Draw bounding boxes on an image.

Parameters:

Name Type Description Default
image NDArray[uint8]

3d array of shape (3, H, W) in CHW format, uint8

required
boxes NDArray[float64]

2d array of boxes in xyxy format, float64

required
colors NDArray[uint8]

optional 2d array of shape (N, 3) with RGB colors per box, uint8

None
thickness int

line thickness in pixels (default 2)

2

Raises:

Type Description
TypeError

if image or boxes are not numpy arrays

ValueError

if image shape is not (3, H, W) or boxes shape is not (N, 4)

Returns:

Type Description
NDArray[uint8]

np.ndarray: 3d array of shape (3, H, W) with boxes drawn

Example

draw_boxes example