彩色图像技术重要函数cv2.addWeighted()

两幅图size、channel、归一化格式都相同,那么

import cv2
import numpy as np


img1 = cv2.imread('lena.jpeg')
img2 = cv2.imread('monalisa.jpg')


w,h,channel = np.shape(img1)
img2 = cv2.resize(img2,(h,w),interpolation=cv2.INTER_CUBIC)


img1 = img1/(np.amax(img1).astype('float'))
img2 = img2/(np.amax(img2).astype('float'))


alpha = 0.7
beta = 1-alpha
gamma = 0
img_add = cv2.addWeighted(img1,alpha,img2,beta,gamma)


cv2.imshow('merge',img_add)

彩色图像技术重要函数cv2.addWeighted()_第1张图片

你可能感兴趣的:(空间艺术Raumkunst)