Skip to content

gapi_add

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

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

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

namespace streaming

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:

\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) +  \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0

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 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"

See: sub, addWeighted

gapi_add(src1: GMat, src2: GMat, ddepth: number): GMat;
2 available overloads
gapi_add(src1: GMat, src2: GMat): GMat;
gapi_add(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.