Skip to content

Instantly share code, notes, and snippets.

@HTLife
Created February 11, 2019 11:46
Show Gist options
  • Save HTLife/e8f1c4ff1737710e34258ef965b48344 to your computer and use it in GitHub Desktop.
Save HTLife/e8f1c4ff1737710e34258ef965b48344 to your computer and use it in GitHub Desktop.
Convert KITTI velodyne bin to open3d pcd
import numpy as np
import struct
from open3d import *
def convert_kitti_bin_to_pcd(binFilePath):
size_float = 4
list_pcd = []
with open(binFilePath, "rb") as f:
byte = f.read(size_float * 4)
while byte:
x, y, z, intensity = struct.unpack("ffff", byte)
list_pcd.append([x, y, z])
byte = f.read(size_float * 4)
np_pcd = np.asarray(list_pcd)
pcd = PointCloud()
pcd.points = Vector3dVector(np_pcd)
return pcd
@sammilei
Copy link

image (16)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment