python读取pcd文件写入txt

参考:https://blog.csdn.net/u013019296/article/details/78727890

基于pcl库读取pcd点云数据写入txt中

pcd数据为binary格式(ascii格式没有测试)

#!/usr/bin/python
# -*- coding: UTF-8 -*-

import pcl

filename = './1542614507.194016000'

p = pcl.load(filename + '.pcd')#读取pcd文件
#写入文件
f = open(filename + '.txt', 'w')
f.write("写入" + str(p.size) + "个数据点" + '\n')
for i in range(p.size):
	f.write(str(p[i][0]) + '\t' + str(p[i][1]) + '\t' + str(p[i][2]) + '\n')
f.write("-------end of file-------")
f.close()

猜你喜欢

转载自blog.csdn.net/GroundWalker/article/details/84781411