MCPcopy Create free account
hub / github.com/ADLab-AutoDrive/BEVFusion / plot_rect3d_on_img

Function plot_rect3d_on_img

mmdet3d/core/visualizer/image_vis.py:205–230  ·  view source on GitHub ↗

Plot the boundary lines of 3D rectangular on 2D images. Args: img (numpy.array): The numpy array of image. num_rects (int): Number of 3D rectangulars. rect_corners (numpy.array): Coordinates of the corners of 3D rectangulars. Should be in the shape of [num_re

(img,
                       num_rects,
                       rect_corners,
                       color=(0, 255, 0),
                       thickness=1)

Source from the content-addressed store, hash-verified

203
204
205def plot_rect3d_on_img(img,
206 num_rects,
207 rect_corners,
208 color=(0, 255, 0),
209 thickness=1):
210 """Plot the boundary lines of 3D rectangular on 2D images.
211
212 Args:
213 img (numpy.array): The numpy array of image.
214 num_rects (int): Number of 3D rectangulars.
215 rect_corners (numpy.array): Coordinates of the corners of 3D
216 rectangulars. Should be in the shape of [num_rect, 8, 2].
217 color (tuple[int], optional): The color to draw bboxes.
218 Default: (0, 255, 0).
219 thickness (int, optional): The thickness of bboxes. Default: 1.
220 """
221 line_indices = ((0, 1), (0, 3), (0, 4), (1, 2), (1, 5), (3, 2), (3, 7),
222 (4, 5), (4, 7), (2, 6), (5, 6), (6, 7))
223 for i in range(num_rects):
224 corners = rect_corners[i].astype(np.int)
225 for start, end in line_indices:
226 cv2.line(img, (corners[start, 0], corners[start, 1]),
227 (corners[end, 0], corners[end, 1]), color, thickness,
228 cv2.LINE_AA)
229
230 return img.astype(np.uint8)
231
232
233def draw_lidar_bbox3d_on_img(bboxes3d,

Callers 3

draw_lidar_bbox3d_on_imgFunction · 0.85
draw_depth_bbox3d_on_imgFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected