Function add_c

Source
pub fn add_c(
    src1: &impl GMatTraitConst,
    c: &impl GScalarTraitConst,
    ddepth: i32,
) -> Result<GMat>
Expand description

Calculates the per-element sum of matrix and given scalar.

The function addC adds a given scalar value to each element of given matrix. The function can be replaced with matrix expressions:

block formula

Depth of the output matrix is determined by the ddepth parameter. If ddepth is set to default -1, the depth of output matrix will be the same as the depth of input matrix. The matrices can be single or multi channel. Output matrix must have the same size and number of channels as the input matrix.

Supported matrix data types are [CV_8UC1], [CV_8UC3], [CV_16UC1], [CV_16SC1], [CV_32FC1].

Note: Function textual ID is “org.opencv.core.math.addC”

§Parameters

  • src1: first input matrix.
  • c: scalar value to be added.
  • ddepth: optional depth of the output matrix.

§See also

sub, addWeighted

§C++ default parameters

  • ddepth: -1