python - Pyexiv2 with Multiprocessing -
i performing batch of distortion corrections on images using opencv. unfortunately output loses exif metadata. bringing using 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()
however when running whole code using multiprocessing pyexiv2 crashes while copying on metadata. possible pyexiv2 starts operating on file cloning metadata while opencv still outputting it. best procedure around pyexiv2/opencv concurrent access issues ? parallel function below:
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)
upgrading latest pyexiv2 fixed issue.
python opencv multiprocessing pyexiv2
No comments:
Post a Comment