Skip to content

gapi_sub

gapifunctionOpenCV 5.0.0
import { gapi_sub } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSsrc1, src2, ddepth
FUNCTIONgapi_sub
RETURN TYPEGMat
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

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:

\texttt{dst}(I) =   \texttt{src1}(I) -  \texttt{src2}(I)

The function can be replaced with matrix expressions:

\texttt{dst} =   \texttt{src1} -  \texttt{src2}

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"

See: add, addC

gapi_sub(src1: GMat, src2: GMat, ddepth: number): GMat;
2 available overloads
gapi_sub(src1: GMat, src2: GMat): GMat;
gapi_sub(src1: GMat, src2: GMat, ddepth: number): GMat;
src1

first input matrix.

src2

second input matrix.

ddepth

optional depth of the output matrix.

Returns

The GMat result. Release returned native handles with using or delete(), including handles nested in results.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.