我正在使用OpenCV对图像执行一批失真校正。不幸的是,输出丢失了exif元数据。所以我用Pyexiv2把它带回来。你知道吗
def propagate_exif(infile,outfile):
import pyexiv2
msrc = pyexiv2.ImageMetadata(infile)
msrc.read()
print msrc.exif_keys
mdst = pyexiv2.ImageMetadata(outfile)
mdst.read()
msrc.copy(mdst,comment=False)
mdst.write()
但是,当使用多处理运行整个代码时,pyexiv2在复制元数据时经常崩溃。当OpenCV仍在输出文件克隆元数据时,pyexiv2可能开始对其进行操作。解决pyexiv2/OpenCV并发访问问题的最佳方法是什么?并行功能如下:
def distortgrid_file(infile,out_dir,mapx,mapy,idealise_matrix=False):
outfile = os.path.join(out_dir,os.path.basename(infile))
#read calibration parameters
apply_distortion(infile, outfile, mapx,mapy)
#preserve exif parameters
propagate_exif(infile,outfile)
升级到最新的pyexiv2修复了这个问题。你知道吗
相关问题 更多 >
编程相关推荐