computer-visionpoint-cloudsfile-readlidar-data

Read Lidar data


I have point-cloud data from Neptec's Opal Lidar in .mat format. The data is in the cartesian format where i have struct type with points in one table and intensity in another struct. I converted it to csv file in python and want to read it for fitting a CNN. The code to read PCD file is as below (from one github repository):

def load_pc_from_pcd(pcd_path):
    """Load PointCloud data from pcd file."""
    p = pcl.load(pcd_path)
    return np.array(list(p), dtype=np.float32)

But i dont have any sample of pcd data type. My csv file is as below:

X,Y,Z,Intensity
-8121.6904296875,163.50155639648438,-18.94129180908203,42.0
-8140.76123046875,182.27249145507812,-22.06368637084961,35.0
-8141.88916015625,183.74932861328125,-21.510177612304688,37.0

As I don't have access to any pcd files, anybody who has worked with pcd files can tell me how to read the CSV files in a proper way?

Thank you!


Solution

  • You can add header like pcd files have. In your case you can write: # .PCD v.7 - Point Cloud Data file format VERSION .7 FIELDS x y z SIZE 4 4 4 TYPE F F F COUNT 1 1 1 WIDTH no_of_points HEIGHT 1 POINTS no_of_points DATA ascii

    Then remove the commas in your file and replace with space.