def display_labels_on_image(camera_calibration, img, labels, visibility):

    # Get the transformation matrix from the vehicle frame to image space.
    vehicle_to_image = utils.get_image_transform(camera_calibration)

    # Draw all the groundtruth labels
    for label,vis in zip(labels, visibility):
        if vis:
            colour = (0,0,200)
        else:
            colour = (128,0,0)

        utils.draw_3d_box(img, vehicle_to_image, label, colour=colour)
def display_labels_on_image(camera_calibration, camera, labels, display_time = -1):
    # Get the image transformation matrix
    vehicle_to_image = utils.get_image_transform(camera_calibration)

    # Decode the JPEG image
    img = utils.decode_image(camera)

    # Draw all the groundtruth labels
    for label in labels:
        utils.draw_3d_box(img, vehicle_to_image, label)

    # Display the image
    cv2.imshow("Image", img)
    cv2.waitKey(display_time)
Exemple #3
0
def display_labels_on_image(camera_calibration, camera, labels, camera_labels, display_time = -1):
    # Get the image transformation matrix
    vehicle_to_image = utils.get_image_transform(camera_calibration)

    # Decode the JPEG image
    img = utils.decode_image(camera)

    # Draw all the groundtruth labels
    box_3d_to_2d = []
    class_labels = [l.type for l in labels]
    for label in labels:
        x1, y1, x2, y2 = utils.get_3d_boxes_to_2d(img, vehicle_to_image, label)
        box_3d_to_2d += [x1, y1, x2, y2]


        utils.draw_3d_box(img, vehicle_to_image, label)
        utils.draw_3d_box(img, vehicle_to_image, label, draw_2d_bounding_box=True, colour=(0, 255, 0))

    for label in camera_labels:
        utils.draw_2d_box(img, label, colour=(255, 0, 255))

    # Display the image
    cv2.imshow("Image", img)
    cv2.waitKey(display_time)