draw_box
-
Description: Draws a bounding box on an image.
-
Parameters:
- img (
np.ndarray
): The image to draw on, as a NumPy array. - box (
Union[Box, np.ndarray]
): The bounding box to draw, either as aBox
object or a NumPy array in the format [x1, y1, x2, y2]. - color (
_Color
): The color of the bounding box. Defaults to (0, 255, 0) (green). - thickness (
_Thickness
): The thickness of the box border. Defaults to 2.
- img (
-
Return Value:
- np.ndarray: The image with the bounding box drawn.
-
Example:
import capybara as cb
img = cb.imread('lena.png')
box = cb.Box([20, 20, 100, 100])
box_img = cb.draw_box(img, box, color=(0, 255, 0), thickness=2)