Skip to content

accumulateWeighted

Image processingfunctionOpenCV 5.0.0
import { accumulateWeighted } from '@banou/opencv-wasm'

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

ARGUMENTSsrc, dst, alpha, mask
FUNCTIONaccumulateWeighted
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Updates a running average.

The function calculates the weighted sum of the input image src and the accumulator dst so that dst becomes a running average of a frame sequence:

\texttt{dst} (x,y)  \leftarrow (1- \texttt{alpha} )  \cdot \texttt{dst} (x,y) +  \texttt{alpha} \cdot \texttt{src} (x,y)  \quad \text{if} \quad \texttt{mask} (x,y)  \ne 0

That is, alpha regulates the update speed (how fast the accumulator "forgets" about earlier images). The function supports multi-channel images. Each channel is processed independently.

See: accumulate, accumulateSquare, accumulateProduct

accumulateWeighted(src: Mat, dst: Mat, alpha: number, mask: Mat): void;
2 available overloads
accumulateWeighted(src: Mat, dst: Mat, alpha: number): void;
accumulateWeighted(src: Mat, dst: Mat, alpha: number, mask: Mat): void;
src

Input image as 1- or 3-channel, 8-bit or 32-bit floating point.

dst

Input/output value, modified by the native operation. %Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point.

alpha

Weight of the input image.

mask

Optional operation mask.

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.