示例#1
0
        np.asarray(lidar_3d.colors)[list(set(deleted))] = [1, 0, 0]
        o3d.visualization.draw_geometries([lidar_3d])

    return filtered


if __name__ == '__main__':
    BASE = '/home/datasets/CADC/cadcd/'
    BASE_mod = '/home/datasets_mod/CADC/cadcd/'
    date = '2018_03_06'
    seq = 16
    frame = 38
    lidar_type = 'aggregated'  # raw, dror, aggregated

    annotations_path =  BASE + date + '/' + format(seq, '04') + "/3d_ann.json"
    annotation = load_annotation(annotations_path)[frame]

    calib_path = BASE + date + '/' + "calib"
    calib = load_calibration(calib_path)

    if lidar_type == 'raw':
        lidar_path = BASE + date + '/' + format(seq, '04') + \
                     "/labeled/lidar_points/data/" + format(frame, '010') + ".bin"
        lidar = np.fromfile(lidar_path, dtype= np.float32).reshape((-1, 4))[:,:3]
    elif lidar_type == 'dror':
        lidar_path = BASE_mod + date + '/' + format(seq, '04') + \
                     "/labeled/lidar_points/lidar_dror/" + format(frame, '010') + ".npy"
        lidar = np.load(lidar_path).reshape((-1, 4))[:,:3]
    elif lidar_type == 'aggregated':
        lidar_path = BASE_mod + date + '/' + format(seq, '04') + \
                     "/labeled/lidar_points/lidar_aggregated/" + format(frame, '010') + ".npy"
示例#2
0
    assert n_aggregate % 2 == 1

    show_3D = True
    show_cam0 = False
    show_allcam = False

    # if show_cam0 or show_allcam:
    #     cmap = cm.get_cmap('jet')
    #     if show_cam0:
    #         _, ax_cam0 = plt.subplots(1, 3)
    #     if show_allcam:
    #         _, ax_allcam = plt.subplots(3, 8)

    # Load 3d annotations
    annotations_path = BASE + date + '/' + format(seq, '04') + "/3d_ann.json"
    annotations = load_annotation(annotations_path)

    # Load novatel IMU data
    novatel_path = BASE + date + '/' + format(seq,
                                              '04') + "/labeled/novatel/data/"
    novatel = load_novatel_data(novatel_path)
    poses = convert_novatel_to_pose(novatel)

    # calib_path = BASE + date + '/' + "calib/"
    # calib = load_calibration(calib_path)

    lidars_no_mobile = []
    for frame in range(len(annotations)):
        lidar_no_mobile_path = BASE_mod + date + '/' + format(seq, '04') + "/labeled/lidar_points/lidar_no_mobile/" + \
                               format(frame, '010') + ".npy"
        lidar_no_mobile = np.load(lidar_no_mobile_path).reshape((-1, 3))
示例#3
0
if VISUALIZE:
    import matplotlib.pyplot as plt
    import matplotlib.cm as cm
    plt.ion()
    _, ax = plt.subplots(2, 2)
    cmap = cm.get_cmap('jet')

for row in trange(start_row, len(cadc_stats)):
    # print('\n------ Date %s, Sequence %d ------' % (cadc_stats.iloc[row, 0], cadc_stats.iloc[row, 1]))
    date = cadc_stats.iloc[row, 0]
    seq = cadc_stats.iloc[row, 1]
    n_frame = cadc_stats.iloc[row, 2]

    annotation_path = BASE + date + '/' + format(seq, '04') + "/3d_ann.json"
    # Load 3d annotations
    annotation = load_annotation(annotation_path)

    calib_path = BASE + date + '/' + "calib/"
    calib = load_calibration(calib_path)
    T_CAM_LIDAR = []
    T_IMG_CAM = []
    for cam in range(8):
        # Projection matrix from lidar to camera (extrinsics)
        T_CAM_LIDAR.append(
            np.linalg.inv(
                np.array(calib['extrinsics']['T_LIDAR_CAM0' +
                                             str(cam)]))[:3, :4])
        # Projection matrix from camera to image (intrinsics)
        T_IMG_CAM.append(
            np.array(calib['CAM0' +
                           str(cam)]['camera_matrix']['data']).reshape(3, 3))