def display_next_frame(event=None): global once frame = next(datafile_iter) # Get the top laser information laser_name = dataset_pb2.LaserName.TOP laser = utils.get(frame.lasers, laser_name) laser_calibration = utils.get(frame.context.laser_calibrations, laser_name) # Parse the top laser range image and get the associated projection. ri, camera_projection, range_image_pose = utils.parse_range_image_and_camera_projection( laser) # Convert the range image to a point cloud. pcl, pcl_attr = utils.project_to_pointcloud(frame, ri, camera_projection, range_image_pose, laser_calibration) # Update the geometry and render the pointcloud pcd.points = o3d.utility.Vector3dVector(pcl) if once: vis.add_geometry(pcd) once = False else: vis.update_geometry(pcd)
def get_lidar(self, frame, idx, all_points=False): '''Get lidar pointcloud TODO: Get all 4 lidar points appeneded together :return pcl: (N, 3) points in (x,y,z) ''' laser_name = dataset_pb2.LaserName.TOP # laser information laser = utils.get(frame.lasers, laser_name) laser_calibration = utils.get(frame.context.laser_calibrations, laser_name) ri, camera_projection, range_image_pose = utils.parse_range_image_and_camera_projection(laser) pcl, pcl_attr = utils.project_to_pointcloud(frame, ri, camera_projection, range_image_pose, laser_calibration) return pcl
table = datafile.get_record_table() print("There are %d frames in this file." % len(table)) # Loop through the whole file ## and display 3D labels. for frameno,frame in enumerate(datafile): # Get the top laser information laser_name = dataset_pb2.LaserName.TOP laser = utils.get(frame.lasers, laser_name) laser_calibration = utils.get(frame.context.laser_calibrations, laser_name) # Parse the top laser range image and get the associated projection. ri, camera_projection, range_image_pose = utils.parse_range_image_and_camera_projection(laser) # Convert the range image to a point cloud. pcl, pcl_attr = utils.project_to_pointcloud(frame, ri, camera_projection, range_image_pose, laser_calibration) # Get the front camera information camera_name = dataset_pb2.CameraName.FRONT camera_calibration = utils.get(frame.context.camera_calibrations, camera_name) camera = utils.get(frame.images, camera_name) # Get the transformation matrix for the camera. vehicle_to_image = utils.get_image_transform(camera_calibration) # Decode the image img = utils.decode_image(camera)