Skip to content

gemm

Core and matricesfunctionOpenCV 5.0.0
import { gemm } from '@banou/opencv-wasm'

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

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

Performs generalized matrix multiplication.

The function cv::gemm performs generalized matrix multiplication similar to the gemm functions in BLAS level 3. For example, gemm(src1, src2, alpha, src3, beta, dst, GEMM_1_T + GEMM_3_T) corresponds to

\texttt{dst} =  \texttt{alpha} \cdot \texttt{src1} ^T  \cdot \texttt{src2} +  \texttt{beta} \cdot \texttt{src3} ^T

In case of complex (two-channel) data, performed a complex matrix multiplication.

The function can be replaced with a matrix expression. For example, the above call can be replaced with:

    dst = alpha*src1.t()*src2 + beta*src3.t();

See: mulTransposed, transform

gemm(src1: Mat, src2: Mat, alpha: number, src3: Mat, beta: number, dst: Mat, flags: number): void;
2 available overloads
gemm(src1: Mat, src2: Mat, alpha: number, src3: Mat, beta: number, dst: Mat): void;
gemm(src1: Mat, src2: Mat, alpha: number, src3: Mat, beta: number, dst: Mat, flags: number): void;
src1

first multiplied input matrix that could be real(CV_32FC1, CV_64FC1) or complex(CV_32FC2, CV_64FC2).

src2

second multiplied input matrix of the same type as src1.

alpha

weight of the matrix product.

src3

third optional delta matrix added to the matrix product; it should have the same type as src1 and src2.

beta

weight of src3.

dst

Output destination, filled by the native operation. output matrix; it has the proper size and the same type as input matrices.

flags

operation flags (cv::GemmFlags)

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.