A: Picture A to be fused
B: Picture B to be fused
Alpha and beta: weight, respectively representing the weight of image A and image B in the fused image.
gamma:静态权重,比如gamma=100,那么所有元素都加100。
import cv2 import numpy as np # 导入两张图片 back=cv2.imread('20220627220106.jpg') people=cv2.imread('20220627214919.jpg') # 查看两张图片大小是否一样 print(back.shape) print(people.shape) # 图片溶合 result=cv2.addWeighted(people,0.7,back,0.3,0) # 显示溶合后的图片 cv2.imshow('result',result) cv2.waitKey(0)