加法
cv.add()是饱和操作,任何像素点相加加过不超过255
numpy直接相加,如果和大于255则结果是与255的差值
建议使用cv.add()函数
import numpy as np
import cv2 as cv
x = np.uint8([250])
y = np.uint8([10])
print( cv.add(x,y) ) # 250+10 = 260 => 255
print( x+y ) # 250+10 = 260 % 256 = 4
权重相加
img1 = cv.imread('ml.png')
img2 = cv.imread('opencv-logo.png')
dst = cv.addWeighted(img1,0.7,img2,0.3,0)
cv.imshow('dst',dst)
cv.waitKey(0)
cv.destroyAllWindows()
按位操作
参考文献:
https://docs.opencv.org/3.4.3/d0/d86/tutorial_py_image_arithmetics.html
https://blog.csdn.net/qq_41905045/article/details/81299272