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

 


 


圖像融合結果 ↑


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM