accumulateWeighted
import { accumulateWeighted } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
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;srcInput image as 1- or 3-channel, 8-bit or 32-bit floating point.
dstInput/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.
alphaWeight of the input image.
maskOptional 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.