针对pcd文件,实现ASCII和binary格式转换
以下仅供我自己学习参考,如有不对的地方,到时候遇到了再说吧
(代码为 菊哥.所写,我只是个什么都不会的垃圾)
代码部分
仅针对pcd文件格式转换
#!/usr/bin/env python
# encoding=utf8
import sys
import logging
import pcl
import re
if __name__ == "__main__":
if sys.argv.__len__() != 3:
print "Usage: pyton ./BA.py source.pcd dest.pcd"
print "Auto adjust the type of file: binary or ascii"
exit(0)
pcl_src_path = sys.argv[1]
pcl_dest_path = sys.argv[2]
p = re.compile("DATA (?P<data_type>\w*)")
data_type = "unknow"
with open(pcl_src_path, 'rt') as pcl_src_handle:
lines = pcl_src_handle.readlines()
for index in range(12):
m = p.match(lines[index])
try:
data_type = m.group("data_type")
break
except Exception as<