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()

 


 


图像融合结果 ↑

posted on 2020-03-23 14:14  我坚信阳光灿烂  阅读(4996)  评论(0编辑  收藏  举报

导航