import cv2 import numpy as np import sys filenames = ['./images/memorial0061.jpg', './images/memorial0062.jpg', './images/memorial0063.jpg', './images/memorial0064.jpg', './images/memorial0065.jpg', './images/memorial0066.jpg', './images/memorial0067.jpg', './images/memorial0068.jpg', './images/memorial0069.jpg', './images/memorial0070.jpg', './images/memorial0071.jpg', './images/memorial0072.jpg', './images/memorial0073.jpg', './images/memorial0074.jpg', './images/memorial0075.jpg', './images/memorial0076.jpg',] # 读取图片 images = [] for filename in filenames: im = cv2.imread(filename) images.append(im) # 使用曝光融合进行merge print('Merging using Exposure Fusion...') mergeMertens = cv2.createMergeMertens() exposureFusion = mergeMertens.process(images) # 保存输出的图片 print('Saving output ... exposure-fusion.jpg') cv2.imwrite('exposure-fusion.jpg', exposureFusion*255)