CloudCompare 导出 ply格式点云导致的 UnicodeDecodeError: 'ascii' codec can't decode
作者:互联网
如题今日处理点云时将.txt格式通过CloudCompare导出成.ply文件,结果用PlyData.read()读取一直报错
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/miniconda3/envs/deep_mls/lib/python3.7/site-packages/plyfile.py", line 395, in read
data = PlyData._parse_header(stream)
File "/root/miniconda3/envs/deep_mls/lib/python3.7/site-packages/plyfile.py", line 373, in _parse_header
while parser.consume(stream.readline()):
File "/root/miniconda3/envs/deep_mls/lib/python3.7/site-packages/plyfile.py", line 120, in consume
line = raw_line.decode('ascii').strip()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 27: ordinal not in range(128)
找了全网博客都没有解决,最后发现CloudCompare导出时会在文件头部加上一段注释
comment Created by CloudCompare v2.11.1 (Anoia)
comment Created 2021/10/31 下午4:44
obj_info Generated by CloudCompare!
就是这段信息影响了读取编码,删掉就解决了。。。。。浪费了我一个多小时
标签:envs,ascii,ply,decode,File,miniconda3,line,packages,CloudCompare 来源: https://www.cnblogs.com/fusheng-rextimmy/p/15490029.html