Function multiply

Source
pub fn multiply(
    src1: &impl ToInputArray,
    src2: &impl ToInputArray,
    dst: &mut impl ToOutputArray,
    scale: f64,
    dtype: i32,
) -> Result<()>
Expand description

Calculates the per-element scaled product of two arrays.

The function multiply calculates the per-element product of two arrays:

block formula

There is also a [MatrixExpressions] -friendly variant of the first function. See Mat::mul .

For a not-per-element matrix product, see gemm .

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.

Note: (Python) Be careful to difference behaviour between src1/src2 are single number and they are tuple/array. multiply(src,X) means multiply(src,(X,X,X,X)). multiply(src,(X,)) means multiply(src,(X,0,0,0)).

§Parameters

  • src1: first input array.
  • src2: second input array of the same size and the same type as src1.
  • dst: output array of the same size and type as src1.
  • scale: optional scale factor.
  • dtype: optional depth of the output array

§See also

add, subtract, divide, scaleAdd, addWeighted, accumulate, accumulateProduct, accumulateSquare, Mat::convertTo

§C++ default parameters

  • scale: 1
  • dtype: -1