{% extends "base.html" %} {% block title %} addWeighted {% endblock %} {% block description %}
Calculates the weighted sum of two arrays.
{% endblock %} {% block signature %}cv2.addWeighted(src1, alpha, src2, beta, gamma[, dst[, dtype]]) → dst{% endblock %} {% block parameters %}
cv2.CV_8U, cv2.CV_16U, cv2.CV_16S, cv2.CV_32F or cv2.CV_64F.src1.src1 and src2. cv2.CV_*): Output image depth. Default is -1 to use src1.depth(), and this is used in this app.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.
{% endblock %} {% block 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