motempl_segmentMotion
import { motempl_segmentMotion } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Splits a motion history image into a few parts corresponding to separate independent motions (for example, left hand, right hand).
motempl_segmentMotion(mhi: Mat, segmask: Mat, boundingRects: RectVector, timestamp: number, segThresh: number): void;mhiMotion history image.
segmaskOutput destination, filled by the native operation. Image where the found mask should be stored, single-channel, 32-bit floating-point.
boundingRectsOutput destination, filled by the native operation. Vector containing ROIs of motion connected components.
timestampCurrent time in milliseconds or other units.
segThreshSegmentation threshold that is recommended to be equal to the interval between motion history "steps" or greater.
The function finds all of the motion segments and marks them in segmask with individual values (1,2,...). It also computes a vector with ROIs of motion connected components. After that the motion direction for every component can be calculated with calcGlobalOrientation using the extracted mask of the particular component.
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.