pub fn add(src1: &GMat, src2: &GMat, ddepth: i32) -> Result<GMat>
Expand description
Calculates the per-element sum of two matrices.
The function add calculates sum of two matrices of the same size and the same number of channels:
The function can be replaced with matrix expressions:
The input matrices and the output matrix can all have the same or different depths. For example, you can add a 16-bit unsigned matrix to a 8-bit signed matrix and store the sum as a 32-bit floating-point matrix. Depth of the output matrix is determined by the ddepth parameter. If src1.depth() == src2.depth(), ddepth can be set to the default -1. In this case, the output matrix will have the same depth as the input matrices.
Supported matrix data types are [CV_8UC1], [CV_8UC3], [CV_16UC1], [CV_16SC1], [CV_32FC1].
Note: Function textual ID is “org.opencv.core.math.add”
Parameters
- src1: first input matrix.
- src2: second input matrix.
- ddepth: optional depth of the output matrix.
See also
sub, addWeighted
C++ default parameters
- ddepth: -1