程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Image fusion in opencv addweighted (Python Implementation)

編輯:Python

List of articles

    • 1. The fusion

1. The fusion

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

Src1: The first image to be fused ;
Alpha: Represents the weight of the first image after fusion (alpha=1-beta);
Src2: The second image for fusion ;
Beta: Represents the weight of the second image after fusion (beta=1-alpha);
Gamma: Fused image plus gamma value ;
Dst: Output image ;
Dtype: The type of image ( The default output and input images have the same bit depth );

import cv2
import os
import cv2
import numpy as np
def Add():
# Read and zoom pictures
lenna=cv2.imread('images/lenna.png')
lenna=cv2.resize(src=lenna,dsize=(450,450))
# Create a picture of the same size
npimg=np.ones(shape=(lenna.shape[0],lenna.shape[1],lenna.shape[2]),dtype=np.uint8)*200
# And two pictures
dst=cv2.addWeighted(src1=lenna,alpha=0.8,src2=npimg,beta=0.2,gamma=20)
# display picture
cv2.imshow('dst',dst)
cv2.waitKey(0)
cv2.destroyAllWindows()
if __name__ == '__main__':
print('Pycharm')
Add()



  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved