[][src]Function opencv::core::add_weighted

pub fn add_weighted(
    src1: &dyn ToInputArray,
    alpha: f64,
    src2: &dyn ToInputArray,
    beta: f64,
    gamma: f64,
    dst: &mut dyn ToOutputArray,
    dtype: i32
) -> Result<()>

Calculates the weighted sum of two arrays.

The function addWeighted calculates the weighted sum of two arrays as follows: block formula 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:

This example is not tested
dst = src1*alpha + src2*beta + gamma;

Note: 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.

Parameters

  • src1: first input array.
  • alpha: weight of the first array elements.
  • src2: second input array of the same size and channel number as src1.
  • beta: weight of the second array elements.
  • gamma: scalar added to each sum.
  • dst: output array that has the same size and number of channels as the input arrays.
  • dtype: optional depth of the output array; when both input arrays have the same depth, dtype can be set to -1, which will be equivalent to src1.depth().

See also

add, subtract, scaleAdd, Mat::convertTo

C++ default parameters

  • dtype: -1