MCPcopy Create free account
hub / github.com/ChartGalaxy/ChartGalaxy / draw_rectangle

Function draw_rectangle

code_generation_benchmark/utils/utils_vis_bbox.py:6–21  ·  view source on GitHub ↗

Draw a rectangle on an image. Args: image: numpy array of shape (H, W, 3), the image to draw on bbox: tuple of (x_min, y_min, x_max, y_max) or list [x_min, y_min, x_max, y_max] color: tuple of (B, G, R), the color of the rectangle thickness: int, thickne

(image, bbox, color=(0, 255, 0), thickness=2)

Source from the content-addressed store, hash-verified

4# draw rectangle in an image
5
6def draw_rectangle(image, bbox, color=(0, 255, 0), thickness=2):
7 """
8 Draw a rectangle on an image.
9
10 Args:
11 image: numpy array of shape (H, W, 3), the image to draw on
12 bbox: tuple of (x_min, y_min, x_max, y_max) or list [x_min, y_min, x_max, y_max]
13 color: tuple of (B, G, R), the color of the rectangle
14 thickness: int, thickness of the rectangle lines
15
16 Returns:
17 numpy array: the image with rectangle drawn
18 """
19 x_min, y_min, x_max, y_max = [int(coord) for coord in bbox]
20 cv2.rectangle(image, (x_min, y_min), (x_max, y_max), color, thickness)
21 return image
22
23def draw_rectangles(image, bboxes, colors=None, thickness=2):
24 """

Callers 3

draw_rectanglesFunction · 0.85
draw_labeled_rectangleFunction · 0.85
vis_one_bboxFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected