Function opencv::gapi::sub

source ·
pub fn sub(src1: &GMat, src2: &GMat, ddepth: i32) -> Result<GMat>
Expand description

Calculates the per-element difference between two matrices.

The function sub calculates difference between two matrices, when both matrices have the same size and the same number of channels: block formula

The function can be replaced with matrix expressions: block formula

The input matrices and the output matrix can all have the same or different depths. For example, you can subtract two 8-bit unsigned matrices store the result as a 16-bit signed 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. The matrices can be single or multi channel.

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

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

Parameters

  • src1: first input matrix.
  • src2: second input matrix.
  • ddepth: optional depth of the output matrix.

See also

add, addC

C++ default parameters

  • ddepth: -1