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)
| 203 | |
| 204 | |
| 205 | def 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 | |
| 233 | def draw_lidar_bbox3d_on_img(bboxes3d, |
no outgoing calls
no test coverage detected