因为要做以图搜图的后台, 公司山大的实习生写了一个算法, 计算图片的hash值, 但是面太窄了, 自己重新改了一下,他用.mat 文件存储的数据, 但是没有解决覆盖的问题
解决思路:
在网上找了一圈,好像没有找到解决覆盖的问题
就是在每次存入数据之前,先把数据提取出来,吧数据和要保存数据整合一下,一起存入mat文件
如果有更好的方法和思路,请各位大佬不吝赐教
mat 文件
.mat文件现在不知道如何追加
.mat文件是以 字典存储的
from scipy.io import savemat, loadmat
savemat 和 loadmat是对.mat文件进行存和读的
savemat()
这是savemat源码
filename 是mat文件路径
mdict 是存储的数据
@docfiller
def savemat(file_name, mdict,
appendmat=True,
format='5',
long_field_names=False,
do_compression=False,
oned_as='row'):
"""
Save a dictionary of names and arrays into a MATLAB-style .mat file.
This saves the array objects in the given dictionary to a MATLAB-
style .mat file.
Parameters
----------
file_name : str or file-like object
Name of the .mat file (.mat extension not needed if ``appendmat ==
True``).
Can also pass open file_like object.
mdict : dict
Dictionary from which to save matfile variables.
appendmat : bool, optional
True (the default) to append the .mat extension to the end of the
given filename, if not already present.
format : {'5', '4'}, string, optional
'5' (the default) for MATLAB 5 a
mat 文件
最新推荐文章于 2025-01-07 14:50:46 发布