nuscenes数据读取和解析
1.nuScenes数据集标注格式的说明:
2.根据json⽂件进⾏读取数据路径
3.根据数据路径读取点云数据
4.官⽅api说明
坐标系说明:世界坐标系的轴的⽅向与IMU坐标系的轴的⽅向相同,所以如果需要将点云数据转换到世界坐标系,⾸先需要将点云数据转到IMU,然后再从IMU转到世界坐标系.
在 ('sample_data', sample_json['data'][ sensor]时,会返回对应的sensor_sample_data_json数据
结果如:
sample_data {
"token":                  <str> -- Unique record identifier.
"sample_token":            <str> -- Foreign key. Sample to which this sample_data is associated.
"ego_pose_token":          <str> -- Foreign key.
"calibrated_sensor_token": <str> -- Foreign key.
"filename":                <str> -- Relative path to data-blob on disk.transform中文翻译
"fileformat":              <str> -- Data file format.
"width":                  <int> -- If the sample data is an image, this is the image width in pixels.
"height":                  <int> -- If the sample data is an image, this is the image height in pixels.
"timestamp":              <int> -- Unix time stamp.
"is_key_frame":            <bool> -- True if sample_data is part of key_frame, else False.
"next":                    <str> -- Foreign key. Sample data from the same sensor that follows this in time. Empty if end of scene.
"prev":                    <str> -- Foreign key. Sample data from the same sensor that precedes this in time. Empty if start of scene.
}
然后根据('calibrated_sensor', sensor_sample_data_json['calibrated_sensor_token'])获取对应的calibrated_sensor_json ⽂件,结果如
calibrated_sensor {
"token":                  <str> -- Unique record identifier.
"sensor_token":            <str> -- Foreign key pointing to the sensor type.
"translation":            <float> [3] -- Coordinate system origin in meters: x, y, z.
"rotation":                <float> [4] -- Coordinate system orientation as quaternion: w, x, y, z.
"camera_intrinsic":        <float> [3, 3] -- Intrinsic camera calibration. Empty for sensors that are not cameras.
}
则此时的translation和rotation就是对应的平移,旋转关系,利⽤⾃带的源码geometry_utils中的transform_matrix,可以得到旋转平移矩阵,采⽤类⾥⾯的transform()⽅法实现对点云从雷达坐标系到IMU坐标系的转换,然后再利⽤ego_pose实现从IMU坐标系到世界坐标系的转换.