Skip to content

multiply

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

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

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

Calculates the per-element scaled product of two arrays.

The function multiply calculates the per-element product of two arrays:

\texttt{dst} (I)= \texttt{saturate} ( \texttt{scale} \cdot \texttt{src1} (I)  \cdot \texttt{src2} (I))

There is also a MatrixExpressions -friendly variant of the first function. See Mat::mul .

For a not-per-element matrix product, see gemm .

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

Note: (Python) Be careful to difference behaviour between src1/src2 are single number and they are tuple/array. multiply(src,X) means multiply(src,(X,X,X,X)). multiply(src,(X,)) means multiply(src,(X,0,0,0)).

See: add, subtract, divide, scaleAdd, addWeighted, accumulate, accumulateProduct, accumulateSquare, Mat::convertTo

multiply(src1: Mat, src2: Mat, dst: Mat, scale: number, dtype: number): void;
3 available overloads
multiply(src1: Mat, src2: Mat, dst: Mat): void;
multiply(src1: Mat, src2: Mat, dst: Mat, scale: number): void;
multiply(src1: Mat, src2: Mat, dst: Mat, scale: number, dtype: number): void;
src1

first input array.

src2

second input array of the same size and the same type as src1.

dst

Output destination, filled by the native operation. output array of the same size and type as src1.

scale

optional scale factor.

dtype

optional depth of the output array

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.