draw_boxes
-
Dependencies
- Install
capybara-docsaid[visualization]first.
- Install
-
Description: Draws multiple bounding boxes on an image.
-
Parameters
- img (
np.ndarray): The image to draw on, as a NumPy array. - boxes (
Union[Boxes, np.ndarray]): A list ofBoxor[[x1, y1, x2, y2], ...]. - colors (
_Colors): Box colors (BGR). A single color or a list. Default is (0, 255, 0). - thicknesses (
_Thicknesses): Line thickness(es). A single value or a list. Default is 2.
- img (
-
Returns
- np.ndarray: The image with the bounding boxes drawn.
-
Example
from capybara import Box, imread
from capybara.vision.visualization.draw import draw_boxes
img = imread('lena.png')
boxes = [Box([20, 20, 100, 100]), Box([150, 150, 200, 200])]
boxes_img = draw_boxes(
img,
boxes,
colors=[(0, 255, 0), (255, 0, 0)],
thicknesses=2,
)