Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

图像融合

cv2.addWeighted(src1, alpha, src2, beta, gamma, dst=None, dtype=None)

  • src1 : 图像
  • alpha : 透明系数
  • src2 : 图像2
  • beta : 透明系数
  • gamma : 亮度调节
import cv2
a = cv2.imread('images/aaa.png')
b = cv2.imread('images/bbb.png')
a = a[:b.shape[0],:b.shape[1],:]
res = cv2.addWeighted(src1=a,alpha=0.3,src2=b,beta=1,gamma=0.3)
cv2.imshow('a',a)
cv2.waitKey(1000)
cv2.imshow('b',b)
cv2.waitKey(1000)
cv2.imshow('res',res)
cv2.waitKey(1000)

cv2.destroyAllWindows()