motempl_updateMotionHistory
import { motempl_updateMotionHistory } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Updates the motion history image by a moving silhouette.
motempl_updateMotionHistory(silhouette: Mat, mhi: Mat, timestamp: number, duration: number): void;silhouetteSilhouette mask that has non-zero pixels where the motion occurs.
mhiInput/output value, modified by the native operation. Motion history image that is updated by the function (single-channel, 32-bit floating-point).
timestampCurrent time in milliseconds or other units.
durationMaximal duration of the motion track in the same units as timestamp .
The function updates the motion history image as follows:
\texttt{mhi} (x,y)= \forkthree{\texttt{timestamp}}{if \(\texttt{silhouette}(x,y) \ne 0\)}{0}{if \(\texttt{silhouette}(x,y) = 0\) and \(\texttt{mhi} < (\texttt{timestamp} - \texttt{duration})\)}{\texttt{mhi}(x,y)}{otherwise}That is, MHI pixels where the motion occurs are set to the current timestamp , while the pixels where the motion happened last time a long time ago are cleared.
The function, together with calcMotionGradient and calcGlobalOrientation , implements a motion templates technique described in [Davis97] and [Bradski00] .
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.