addWeighted

Description

Calculates the weighted sum of two arrays.

Signature

cv2.addWeighted(src1, alpha, src2, beta, gamma[, dst[, dtype]]) → dst

Parameters

Explanation

The function addWeighted calculates the weighted sum of two arrays as follows:

dst(I)=saturate(src1(I) x alpha + src2(I) x beta + gamma)

where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently. The function can be replaced with a matrix expression:

dst = src1 x alpha + src2 x beta + gamma

Notes

Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.


References

Created with OpenCV 4.4.0