Skip to content

motempl_segmentMotion

optflowfunctionOpenCV 5.0.0
import { motempl_segmentMotion } from '@banou/opencv-wasm'

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

ARGUMENTSmhi, segmask, boundingRects, timestamp
FUNCTIONmotempl_segmentMotion
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

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;
mhi

Motion history image.

segmask

Output destination, filled by the native operation. Image where the found mask should be stored, single-channel, 32-bit floating-point.

boundingRects

Output destination, filled by the native operation. Vector containing ROIs of motion connected components.

timestamp

Current time in milliseconds or other units.

segThresh

Segmentation 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.