#定义一个三维点类
class Point(object):
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
def pcd2txt(filename):
points = []
#读取pcd文件,从pcd的第12行开始是三维点
with open(filename) as f:
for line in f.readlines()[11:len(f.readlines())-1]:
strs = line.split(' ')
points.append(Point(strs[0],strs[1],strs[2].strip()))
fw = open("resources/rabbit.txt",'w')
for i in range(len(points)):
linev = points[i].x+" "+points[i].y+" "+points[i].z+"\n"
fw.writelines(linev)
fw.close()
3D点云之#pcd格式转txt
最新推荐文章于 2023-07-04 23:11:38 发布