我正在使用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运行整个代码时,在复制元数据时经常会崩溃。pyexiv2有可能在OpenCV还在输出时开始对文件克隆元数据进行操作。解决pyexiv2 2/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)发布于 2014-06-26 02:53:48
升级到最新的pyexiv2解决了这个问题。
https://stackoverflow.com/questions/24378087
复制相似问题