I'm trying to downsample a point cloud. I have 2 data formats for different parts of my data. The .bin files cause no problems, but when I'm trying to downsample the .e57 files I encounter a strange problem. Here's what I do:
import numpy as np
import open3d
pointfile = "path/to/file.e57"
pcd_data = np.fromfile(point_file, dtype=np.float32)
pcd_data = velo_data.reshape(-1, 4)
pcd_points = velo_data[:, :3]
pcd = open3d.geometry.PointCloud()
pcd.points = open3d.utility.Vector3dVector(pcd_points)
pcd_down = pcd.voxel_down_sample(voxel_size=0.8)
res = np.asarray(pcd_down.points)
It works fine for .bin, but when i try the .e57 I get the error:
RuntimeError: [Open3D ERROR] [VoxelDownSample] voxel_size is too small.
No matter if I use voxel_size of 0.005, 0.8, 100, 5000 or 1000000000000000.
I tried the earlier open3d Version:
pcd_down = open3d.geometry.voxel_down_sample(voxel_size=0.8)
and at least it throws no error, but my downsampled pointcloud then contains 0 points (from ~350 000).
As the file should be structured in points with 4 features, the file seems to be read correctly (this works for any of my files), as the reshape works just fine.
Any ideas?
Still have no clue about the original error, but I succesfully worked around the problem by using pye57: https://github.com/davidcaron/pye57 together with this solution to a possibly occuring problem: https://github.com/davidcaron/pye57/issues/6#issuecomment-803894677
With this code
I finally get a downsampled point cloud.