python.e57文件读写器
pye57的Python项目详细描述
PYE57
python包装LibE57Format来读写.e57点云文件
示例用法
importnumpyasnpimportpye57e57=pye57.E57("e57_file.e57")# read scan at index 0data=e57.read_scan(0)# 'data' is a dictionary with the point types as keysassertisinstance(data["cartesianX"],np.ndarray)assertisinstance(data["cartesianY"],np.ndarray)assertisinstance(data["cartesianZ"],np.ndarray)# other attributes can be read using:data=e57.read_scan(0,intensity=True,colors=True,row_column=True)assertisinstance(data["cartesianX"],np.ndarray)assertisinstance(data["cartesianY"],np.ndarray)assertisinstance(data["cartesianZ"],np.ndarray)assertisinstance(data["intensity"],np.ndarray)assertisinstance(data["colorRed"],np.ndarray)assertisinstance(data["colorGreen"],np.ndarray)assertisinstance(data["colorBlue"],np.ndarray)assertisinstance(data["rowIndex"],np.ndarray)assertisinstance(data["columnIndex"],np.ndarray)# the 'read_scan' method filters points using the 'cartesianInvalidState' field# if you want to get everything as raw, untransformed data, use:data_raw=e57.read_scan_raw(0)# writing is also possible, but only using raw data for nowe57_write=pye57.E57("e57_file_write.e57",mode='w')e57_write.write_scan_raw(data_raw)# you can specify a header to copy information frome57_write.write_scan_raw(data_raw,scan_header=e57.get_header(0))# the ScanHeader object wraps most of the scan information:header=e57.get_header(0)print(header.point_count)print(header.rotation_matrix)print(header.translation)# all the header information can be printed using:forlineinheader.pretty_print():print(line)# the scan position can be accessed with:position_scan_0=e57.scan_position(0)# the binding is very close to the E57Foundation API# you can modify the nodes easily from pythonimf=e57.image_fileroot=imf.root()data3d=root["data3D"]scan_0=data3d[0]translation_x=scan_0["pose"]["translation"]["x"]
安装
pip install pye57
如果您在windows上使用python 3.5或3.6,则可以使用控制盘。
否则,请参阅下面的建筑注释。
建筑注释
窗口
xerces-c的二进制文件可以从conda获得,使用:conda install xerces-c
Linux
在安装之前安装libxerces-c-dev。