1234567891011121314151617181920212223 |
- import open3d as o3d
- import numpy as np
- def pcd_to_binary(pcd_file, output_file):
- pcd = o3d.io.read_point_cloud(pcd_file)
- points = np.asarray(pcd.points)
- binary_data = points[:, :3]
- with open(output_file, 'wb') as f:
- f.write(binary_data.tobytes())
- if __name__ == '__main__':
- pcd_to_binary(r'/home/robot/ROS/ren_yuan/ren_yuan_pointcloud/123.pcd', r'/home/robot/ROS/ren_yuan/ren_yuan_pointcloud/pointcloud.txt')
-
|