ply文件修复过程

有一款3D相机有输出点云格式ply但是用halcon,open3D都打不开很恼火

ply有二进制和文本两种格式;实际上还是txt

文件放出来: 因为 几十万行放出来没多大意义 所以复制了一部分

这个文件的问题是 空行用 -nan(ind) -nan(ind) -nan(ind) 填充的.

需要做的是把 -nan(ind) -nan(ind) -nan(ind) 删除掉

在修改 element vertex 3145728为删掉的行数减去8

为啥是8呢,因为文件头除了点数以外 一共8行:

ply
format ascii 1.0
obj_info generated by IMALLIGENT
element vertex 3145728
property float x
property float y
property float z
end_header
ply
format ascii 1.0
obj_info generated by IMALLIGENT
element vertex 3145728
property float x
property float y
property float z
end_header
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
104.267 -75.2547 854.29
104.531 -75.2785 854.56
104.802 -75.3062 854.875
105.067 -75.33 855.145
105.343 -75.3617 855.505
105.614 -75.3895 855.82
105.883 -75.4159 856.12
106.154 -75.4436 856.435
106.388 -75.445 856.45
106.632 -75.4529 856.54
106.879 -75.4635 856.66
107.123 -75.4714 856.75
107.355 -75.4714 856.75
107.582 -75.4674 856.705
107.888 -75.519 857.29
108.181 -75.5612 857.77
108.468 -75.5996 858.205
108.773 -75.6498 858.775
109.078 -75.7 859.345
109.311 -75.7 859.345
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-59.1537 239.334 1119.19
-58.8636 239.389 1119.45
-58.5624 239.399 1119.49
-58.2604 239.405 1119.52
-57.9599 239.418 1119.58
-57.6571 239.421 1119.59
-57.3558 239.431 1119.64
-57.0522 239.431 1119.64
-56.7494 239.434 1119.66
-56.4556 239.475 1119.85
-56.1684 239.546 1120.18
-55.8946 239.674 1120.78
-55.5907 239.674 1120.78
-55.3615 239.998 1122.29
-55.0601 240.011 1122.35
-54.7594 240.027 1122.43
-54.455 240.027 1122.43
-54.1333 239.95 1122.07
-53.829 239.95 1122.07
-53.5212 239.934 1121.99
-53.2162 239.931 1121.98
-52.7705 239.289 1118.98
-52.4671 239.289 1118.98
-52.0175 238.619 1115.84
-51.7149 238.619 1115.84
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-50.8488 238.815 1116.76
-50.5854 239.001 1117.63
-50.2823 239.001 1117.63
-50.0242 239.216 1118.64
-49.7208 239.216 1118.64
-49.4466 239.357 1119.29
-49.149 239.386 1119.43
-45.8148 239.411 1119.55
-45.5112 239.411 1119.55
-45.2525 239.649 1120.66
-44.9486 239.649 1120.66
-44.6315 239.578 1120.33
-44.3147 239.508 1120
-44.0086 239.495 1119.94
-43.7243 239.601 1120.44
-43.432 239.665 1120.73
-43.1345 239.7 1120.9
-42.8305 239.7 1120.9
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-29.5839 186.773 873.4
-29.3471 186.773 873.4
-29.1092 186.767 873.37
-28.8709 186.757 873.325
-28.6316 186.741 873.25
-28.3938 186.735 873.22
-28.1571 186.735 873.22
-27.9207 186.738 873.235
-27.6859 186.751 873.295
-27.4509 186.764 873.355
-27.2155 186.773 873.4
-26.9787 186.773 873.4
-26.7418 186.773 873.4
-26.5045 186.77 873.385
-26.2681 186.773 873.4
-26.0322 186.78 873.43
-25.7967 186.789 873.475
-25.5607 186.796 873.505
-25.3247 186.802 873.535
-25.0891 186.812 873.58
-24.8526 186.815 873.595
-24.6174 186.828 873.655
-24.3822 186.84 873.715
-24.1478 186.86 873.805
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-23.9133 186.879 873.895
-23.6783 186.895 873.97
-23.4417 186.898 873.985
-23.2028 186.882 873.91
-22.9634 186.863 873.82
-22.7265 186.863 873.82
-22.4965 186.921 874.09
-22.2682 186.994 874.435
-22.0387 187.059 874.735
-21.8033 187.075 874.81
-21.5642 187.059 874.735
-21.3252 187.043 874.66
-21.087 187.033 874.615
16.2661 188.393 880.975
91.4658 190.273 889.765
91.7272 190.314 889.96
91.9902 190.359 890.17
92.2751 190.449 890.59
92.554 190.526 890.95
92.8253 190.587 891.235
93.067 190.587 891.235
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)
-nan(ind) -nan(ind) -nan(ind)

直接上修复脚本:

r""" 
使用说明  将txt格式的ply文件 拖入 该图标 运行即可 安装python3.7以及以上可以运行
"""
import os,sys,time

try:
	if True:# 目的是文件拖拽到图标上 自动获取文件名 
		path=os.getcwd()
		script_path = sys.argv[1]# 获取脚本的完整路径
		script_dir = os.path.dirname(script_path)# 获取脚本的目录路径
		script_name_with_extension = os.path.basename(script_path)# 获取脚本的文件名(带后缀)
		script_name, script_extension = os.path.splitext(script_name_with_extension)# 获取脚本的文件名(不含后缀)和后缀名
		print(f"脚本路径{path}")
		print("脚本路径:", script_path)
		print("脚本所在目录:", script_dir)
		print("脚本文件名(带后缀):", script_name_with_extension)
		print("脚本文件名(不含后缀):", script_name)
		print("脚本后缀名:", script_extension)
		# 定义文件路径 
		input_file = f'{path}\{script_name_with_extension}'
		output_file = f'{path}\cleaned__修复__{script_name_with_extension}'
	else:
		input_file = "0314_1624txtply.ply"
		output_file = f'cleaned__0314_1624txt.ply'
except:
    pass
    input("需要 拖拽文件到该程序才能运行!")
    sys.exit()		
print(f"{input_file}  {output_file}")
#element vertex 1145728  #想改 这个数字 但是需要遍历以后才能知道
i = 0
I=0 
# 打开输入文件进行读取
with open(input_file, 'r', encoding='utf-8') as file:
    # 打开输出文件进行写入
    with open(output_file, 'w', encoding='utf-8') as cleaned_file:
        # 逐行读取输入文件
	
        for line in file:
		
            # 检查行是否包含 "-nan(ind)",如果不包含则写入输出文件
            if "-nan(ind)" not in line:
                i=i+1
                cleaned_file.write(line)
X=3145728-i# 不对
X=i-8# 前面8行是配置 后面才是点数
#修改element vertex 1145728    这个数字=3145728-i 他在文件的第四行
#element vertex 1145728 为1
# 文件路径
file_path = output_file
try:
    # 以读写模式打开文件
    with open(file_path, 'r+', encoding='utf-8') as file:
        lines = file.readlines()  # 读取所有行
        if len(lines) >= 4:# 检查文件是否至少有4行
            lines[3] = f"element vertex {X}\n"# 替换第四行为 计算值"
            file.seek(0)# 将文件指针移动到开头,准备写入
            file.writelines(lines)
            file.truncate()  # 确保文件大小调整到当前内容的大小
            print("第四行已成功修改!")
        else:
            print("文件不足4行,无法修改第四行。")
except FileNotFoundError:
    print(f"错误:文件 {file_path} 未找到。")
except Exception as e:
    print(f"发生错误:{e}")
print(f"处理完成,结果已保存到 {X} {output_file}")
time.sleep(3)#停几秒 能看到回显
input("OK")

修复后的文件:

ply
format ascii 1.0
obj_info generated by IMALLIGENT
element vertex 1267955
property float x
property float y
property float z
end_header
-235.309 -258.305 1287.64
-234.96 -258.305 1287.64
-234.707 -258.41 1288.17
-234.447 -258.509 1288.66
-234.139 -258.554 1288.89
-233.803 -258.569 1288.96
-233.432 -258.545 1288.84
-233.058 -258.518 1288.7
-232.692 -258.5 1288.61
-232.343 -258.5 1288.61
-231.999 -258.506 1288.65
-231.654 -258.512 1288.68
-231.305 -258.512 1288.68
-230.972 -258.53 1288.76
-230.638 -258.548 1288.85
-230.3 -258.56 1288.92
-229.95 -258.56 1288.92
-229.598 -258.557 1288.9
-229.251 -258.56 1288.92
-228.909 -258.569 1288.96
-228.557 -258.566 1288.95
-228.197 -258.554 1288.89
此处省略:31937556-30行

好了可以愉快的打开了: halcon打开报错说明格式不对.

* 关闭当前窗口(如果有)
dev_close_window ()
* 打开一个新的窗口用于显示3D模型
dev_open_window (0, 0, 800, 600, 'black', WindowHandle)
* 设置窗口为3D显示模式

* 读取PLY文件,这里假设文件路径为'D:/work/point_cloud.ply'
read_object_model_3d ('cleaned__修复__0314_1624txtply.ply', 'm', [], [], ObjectModel3D, Status)

*read_object_model_3d ('rabbit.pcd', 'm', [], [], ObjectModel3D, Status)
dev_get_window (WindowHandle)
visualize_object_model_3d (WindowHandle, ObjectModel3D, [], [], ['lut','color_attrib'], ['color1','coord_z'], [], [], [], PoseOut)

open3D也打开试试:

import open3d as o3d

# 读取点云文件
pcd = o3d.io.read_point_cloud("cleaned_18_33_23_198.ply")  # 替换为你的PLY文件路径

# 可视化点云
o3d.visualization.draw_geometries([pcd])

 当然我i还是喜欢 windowsapi  win32ui.CreateFileDialog

import open3d as o3d
import numpy as np
import win32ui,os,sys,time
def getfilepath(path=f'{os.getcwd()}'):
    dlg =win32ui.CreateFileDialog(1)
    dlg.SetOFNInitialDir(path)
    dlg.DoModal()
    filename=dlg.GetPathName();#
    return filename
print("读取点云并可视化")
pcd = o3d.io.read_point_cloud(f"{getfilepath()}")
print(pcd);print(np.asarray(pcd.points))
o3d.visualization.draw_geometries([pcd])

用这个打开. 当然ply得是文本格式 二进制格式咱也不知道咋球搞得

截图就不了.结束.

还是修复完直接显示吧:

程序几乎不变:

r""" 
使用说明  将txt格式的ply文件 拖入 该图标 运行即可 安装python3.7以及以上可以运行
"""
import os,sys,time

try:
	if True:# 目的是文件拖拽到图标上 自动获取文件名 
		path=os.getcwd()
		script_path = sys.argv[1]# 获取脚本的完整路径
		script_dir = os.path.dirname(script_path)# 获取脚本的目录路径
		script_name_with_extension = os.path.basename(script_path)# 获取脚本的文件名(带后缀)
		script_name, script_extension = os.path.splitext(script_name_with_extension)# 获取脚本的文件名(不含后缀)和后缀名
		print(f"脚本路径{path}")
		print("脚本路径:", script_path)
		print("脚本所在目录:", script_dir)
		print("脚本文件名(带后缀):", script_name_with_extension)
		print("脚本文件名(不含后缀):", script_name)
		print("脚本后缀名:", script_extension)
		# 定义文件路径 
		input_file = f'{path}\{script_name_with_extension}'
		output_file = f'{path}\cleaned__修复__{script_name_with_extension}'
	else:
		input_file = "0314_1624txtply.ply"
		output_file = f'cleaned__0314_1624txt.ply'
except:
    pass
    input("需要 拖拽文件到该程序才能运行!")
    sys.exit()		
print(f"{input_file}  {output_file}")
#element vertex 1145728  #想改 这个数字 但是需要遍历以后才能知道
i = 0
I=0 
# 打开输入文件进行读取
with open(input_file, 'r', encoding='utf-8') as file:
    # 打开输出文件进行写入
    with open(output_file, 'w', encoding='utf-8') as cleaned_file:
        # 逐行读取输入文件
	
        for line in file:
		
            # 检查行是否包含 "-nan(ind)",如果不包含则写入输出文件
            if "-nan(ind)" not in line:
                i=i+1
                cleaned_file.write(line)
X=3145728-i# 不对
X=i-8# 前面8行是配置 后面才是点数
#修改element vertex 1145728    这个数字=3145728-i 他在文件的第四行
#element vertex 1145728 为1
# 文件路径
file_path = output_file
try:
    # 以读写模式打开文件
    with open(file_path, 'r+', encoding='utf-8') as file:
        lines = file.readlines()  # 读取所有行
        if len(lines) >= 4:# 检查文件是否至少有4行
            lines[3] = f"element vertex {X}\n"# 替换第四行为 计算值"
            file.seek(0)# 将文件指针移动到开头,准备写入
            file.writelines(lines)
            file.truncate()  # 确保文件大小调整到当前内容的大小
            print("第四行已成功修改!")
        else:
            print("文件不足4行,无法修改第四行。")
except FileNotFoundError:
    print(f"错误:文件 {file_path} 未找到。")
except Exception as e:
    print(f"发生错误:{e}")
print(f"处理完成,结果已保存到 {X} {output_file}")
time.sleep(3)#停几秒 能看到回显

try:

	import open3d as o3d

	# 读取点云文件
	pcd = o3d.io.read_point_cloud(f"{output_file}")  # 替换为你的PLY文件路径

	# 可视化点云
	o3d.visualization.draw_geometries([pcd])

except Exception as e:
    print(f"install open3D:{e}")

input("OK")

就不截图显示了. 省的泄密 :程序叫:"ImalligentViewer"

2025/03/18既然ascall模式有问题那么二进制是不是有同样的的问题呢:

特意下载了hex编辑器看看:

发现文件头是明码: 并且有一个重要信息format binary_little_endian 那么好办了直接把文件头过滤剩余数据全部按照binary_little_endian 小端模式 4位解码浮点数:

ply
format binary_little_endian 1.0
obj_info generated by IMALLIGENT
element vertex 999999999
property float x
property float y
property float z
end_header

先把它打印出来:又发现浮点数是有很多 nul 注意这里有个概念: 数据类型是float但是数值是nan

先介绍一下这个概念:

在 Python 中,float 类型的 NaN(Not a Number)是一个特殊的值,
用于表示未定义或不可表示的浮点数值。
NaN 的类型确实是 <class 'float'>,但它有一些特殊的性质和行为:
NaN 不等于任何值,包括它自己:
任何涉及 NaN 的运算结果仍然是 NaN
以下两种方法定义:
nan_value = float('nan')
nan_value = math.sqrt(-1)  # 负数的平方根
以下两种方法检测 NaN 值
print(np.isnan(nan_value))  # 输出: True
print(math.isnan(nan_value))  # 输出: True

好问题发现了直接放程序:过滤掉无法解码的浮点数文件头写入点数就可以了:

import struct
import math

def process_binary_file(file_path):
    with open(file_path, 'rb') as file:# 打开二进制文件
        for _ in range(7):# 跳过前7行(假设每行以换行符结束)
            file.readline()
        eighth_line = file.readline().decode('utf-8', errors='ignore').strip()# 读取第8行,检查是否包含 'end_header' 字符
        if 'end_header' not in eighth_line:
            print("第8行未找到 'end_header',可能文件格式不正确")
            return
        binary_data = file.read()# 找到 'end_header' 后,读取剩余的二进制数据
        # 解码二进制数据为数值(假设是 4 字节的浮点数,根据实际情况调整)
        # 使用 little-endian 模式
        data_format = '<f'  # '<' 表示 little-endian,'f' 表示浮点数
        data_size = struct.calcsize(data_format)
        num_elements = len(binary_data) // data_size
        decoded_data = []
        for i in range(num_elements):
            start = i * data_size
            end = start + data_size
            value = struct.unpack(data_format, binary_data[start:end])[0]
			# !!! 注意这里 有个概念

            if not math.isnan(value):#print(value,"有")
                decoded_data.append(value)
        return decoded_data

def write_to_binary_file(decoded_data, output_file_path):
    if decoded_data:
        vertex_count = int(len(decoded_data) / 3)
        file_header = rf"""ply
format binary_little_endian 1.0
obj_info generated by IMALLIGENT
element vertex {vertex_count}
property float x
property float y
property float z
end_header
"""
        with open(output_file_path, 'wb') as output_file:# 将文件头和解码后的数据写入新的二进制文件
            
            output_file.write(file_header.encode('utf-8'))# 写入文件头
            
            # 写入解码后的数据( 4 字节的浮点数,little-endian 模式)
            data_format = '<f'
            for value in decoded_data:
                output_file.write(struct.pack(data_format, value))
    pass
	

file_path = '202503101817_bin.ply'  # 二进制文件路径
output_file_path = 'out202503101817_bin.ply'  # 输出文件路径
decoded_data = process_binary_file(file_path)
if decoded_data:
    print("解码后的数据数量:", len(decoded_data))
    write_to_binary_file(decoded_data, output_file_path)
    print(f"数据已写入 {output_file_path}")

当然还是老规矩 你也可以:加上显示:

#显示	
import open3d as o3d
pcd = o3d.io.read_point_cloud(output_file_path) 
o3d.visualization.draw_geometries([pcd])

或者:还是做成和ascall模式的程序一样的风格文件拖拽运行:

r""" 
使用说明  将txt格式的ply文件 拖入 该图标 运行即可 安装python3.7以及以上可以运行
"""
import os,sys,time
import struct
import math
try:
	if True:# 目的是文件拖拽到图标上 自动获取文件名 
		path=os.getcwd()
		script_path = sys.argv[1]# 获取脚本的完整路径
		script_dir = os.path.dirname(script_path)# 获取脚本的目录路径
		script_name_with_extension = os.path.basename(script_path)# 获取脚本的文件名(带后缀)
		script_name, script_extension = os.path.splitext(script_name_with_extension)# 获取脚本的文件名(不含后缀)和后缀名
		print(f"脚本路径{path}")
		print("脚本路径:", script_path)
		print("脚本所在目录:", script_dir)
		print("脚本文件名(带后缀):", script_name_with_extension)
		print("脚本文件名(不含后缀):", script_name)
		print("脚本后缀名:", script_extension)
		# 定义文件路径 
		input_file = f'{path}\{script_name_with_extension}'
		output_file = f'{path}\cleaned__修复_bin_{script_name_with_extension}'
	else:
		input_file = "0314_1624txtply.ply"
		output_file = f'cleaned__0314_1624txt.ply'
except:
    pass
    input("需要 拖拽文件到该程序才能运行!")
    sys.exit()		
print(f"{input_file}  {output_file}")
#element vertex 1145728  #想改 这个数字 但是需要遍历以后才能知道
""" 
nan, nan, nan, 
nan, nan, nan, 
nan, nan, nan, 
nan, nan, nan, 
"""
r"""
在 Python 中,float 类型的 NaN(Not a Number)是一个特殊的值,
用于表示未定义或不可表示的浮点数值。
NaN 的类型确实是 <class 'float'>,但它有一些特殊的性质和行为:
NaN 不等于任何值,包括它自己:
任何涉及 NaN 的运算结果仍然是 NaN
以下两种方法定义:
nan_value = float('nan')
nan_value = math.sqrt(-1)  # 负数的平方根
以下两种方法检测 NaN 值
print(np.isnan(nan_value))  # 输出: True
print(math.isnan(nan_value))  # 输出: True
""" 
def process_binary_file(file_path):
    with open(file_path, 'rb') as file:# 打开二进制文件
        for _ in range(7):# 跳过前7行(假设每行以换行符结束)
            file.readline()
        eighth_line = file.readline().decode('utf-8', errors='ignore').strip()# 读取第8行,检查是否包含 'end_header' 字符
        if 'end_header' not in eighth_line:
            print("第8行未找到 'end_header',可能文件格式不正确")
            return
        binary_data = file.read()# 找到 'end_header' 后,读取剩余的二进制数据
        # 解码二进制数据为数值(假设是 4 字节的浮点数,根据实际情况调整)
        # 使用 little-endian 模式
        data_format = '<f'  # '<' 表示 little-endian,'f' 表示浮点数
        data_size = struct.calcsize(data_format)
        num_elements = len(binary_data) // data_size
        decoded_data = []
        for i in range(num_elements):
            start = i * data_size
            end = start + data_size
            value = struct.unpack(data_format, binary_data[start:end])[0]
			# !!! 注意这里 有个概念

            if not math.isnan(value):#print(value,"有")
                decoded_data.append(value)
        return decoded_data

def write_to_binary_file(decoded_data, output_file_path):
    if decoded_data:
        vertex_count = int(len(decoded_data) / 3)
        file_header = rf"""ply
format binary_little_endian 1.0
obj_info generated by IMALLIGENT
element vertex {vertex_count}
property float x
property float y
property float z
end_header
"""
        with open(output_file_path, 'wb') as output_file:# 将文件头和解码后的数据写入新的二进制文件
            
            output_file.write(file_header.encode('utf-8'))# 写入文件头
            
            # 写入解码后的数据( 4 字节的浮点数,little-endian 模式)
            data_format = '<f'
            for value in decoded_data:
                output_file.write(struct.pack(data_format, value))
    pass

file_path =input_file
output_file_path =output_file
decoded_data = process_binary_file(file_path)
if decoded_data:
    print("解码后的数据数量:", len(decoded_data))
    write_to_binary_file(decoded_data, output_file_path)
    print(f"数据已写入 {output_file_path}")

#显示	

try:

	import open3d as o3d

	# 读取点云文件
	pcd = o3d.io.read_point_cloud(f"{output_file}")  # 替换为你的PLY文件路径

	# 可视化点云
	o3d.visualization.draw_geometries([pcd])

except Exception as e:
    print(f"install open3D:{e}")

input("OK")

嗯 ascall模式 就是去掉字符串 -nan(ind) 更新行数

每个行3个浮点数代表XYZ 最后更新一下点数。

bin模式反而更容易:

先抛弃文件头:剩余数据用4字节 小端模式解码浮点数 抛弃 nan 的浮点数 剩下来的就是有用的,最后写入编码过的文件头,(当然要在文件头更新点数,浮点数数据长度除以3 就是点数)在写入数据就可以了。当然同样大小的图 ascall 模式要比bin模式文件大一半 比如30M的 文本,大约15M的二进制。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值