python 实现图片融合

  • Post author:
  • Post category:python


python 实现图片融合

import cv2
import numpy as np

# Read image
img = cv2.imread("../paojie.jpg").astype(np.float32)
H, W, C = img.shape

img2 = cv2.imread("../bird.png").astype(np.float32)
img = cv2.resize(img,img2.shape[:2])

# 设置权重
a = 0.6
out = img * a + img2 * (1 - a)
out = out.astype(np.uint8)
    
# Save result
cv2.imwrite("out.jpg", out)
cv2.imshow("result", out)
cv2.waitKey(0)
cv2.destroyAllWindows()



版权声明:本文为xuezhangjun0121原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。