Skip to content

gapi_addWeighted

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

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

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

Calculates the weighted sum of two matrices.

The function addWeighted calculates the weighted sum of two matrices as follows:

\texttt{dst} (I)= \texttt{saturate} ( \texttt{src1} (I)* \texttt{alpha} +  \texttt{src2} (I)* \texttt{beta} +  \texttt{gamma} )

where I is a multi-dimensional index of array elements. In case of multi-channel matrices, each channel is processed independently.

The function can be replaced with a matrix expression:

\texttt{dst}(I) =  \texttt{alpha} * \texttt{src1}(I) - \texttt{beta} * \texttt{src2}(I) + \texttt{gamma} 

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

Note: Function textual ID is "org.opencv.core.matrixop.addweighted"

See: add, sub

gapi_addWeighted(src1: GMat, alpha: number, src2: GMat, beta: number, gamma: number, ddepth: number): GMat;
2 available overloads
gapi_addWeighted(src1: GMat, alpha: number, src2: GMat, beta: number, gamma: number): GMat;
gapi_addWeighted(src1: GMat, alpha: number, src2: GMat, beta: number, gamma: number, ddepth: number): GMat;
src1

first input matrix.

alpha

weight of the first matrix elements.

src2

second input matrix of the same size and channel number as src1.

beta

weight of the second matrix elements.

gamma

scalar added to each sum.

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.