两张图片融合
# dst = src1*a+src2*(1-a)
import cv2
import numpy as np
img0 = cv2.imread('image0.jpg',1)
img1 = cv2.imread('image1.jpg',1)
imgInfo = img0.shape
height = imgInfo[0]
width = imgInfo[1]
# ROI
roiH = int(height/2) #长宽一点要小于原来,否则报错
roiW = int(width/2)
img0ROI = img0[0:roiH,0:roiW] #我们要处理的图片0区域
img1ROI = img1[0:roiH,0:roiW] #图片1的区域
# dst
dst = np.zeros((roiH,roiW,3),np.uint8)
dst = cv2.addWeighted(img0ROI,0.5,img1ROI,0.5,0)#add src1*a+src2*(1-a) 最后一个参数0-100 0则浓,100则淡
# 1 src1 2 a 3 src2 4 1-a
cv2.imshow('dst',dst)
cv2.waitKey(0)