addWeighted(src1, alpha, src2, beta, gamma, dst=None, dtype=None):
Src1: The first image to be fused
;Alpha: Represents the weight of the first image after fusion (alpha=1-beta)
;Src2: The second image for fusion
;Beta: Represents the weight of the second image after fusion (beta=1-alpha)
;Gamma: Fused image plus gamma value
;Dst: Output image
;Dtype: The type of image ( The default output and input images have the same bit depth )
;
import cv2
import os
import cv2
import numpy as np
def Add():
# Read and zoom pictures
lenna=cv2.imread('images/lenna.png')
lenna=cv2.resize(src=lenna,dsize=(450,450))
# Create a picture of the same size
npimg=np.ones(shape=(lenna.shape[0],lenna.shape[1],lenna.shape[2]),dtype=np.uint8)*200
# And two pictures
dst=cv2.addWeighted(src1=lenna,alpha=0.8,src2=npimg,beta=0.2,gamma=20)
# display picture
cv2.imshow('dst',dst)
cv2.waitKey(0)
cv2.destroyAllWindows()
if __name__ == '__main__':
print('Pycharm')
Add()