Skip to content

motempl_calcGlobalOrientation

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

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

ARGUMENTSorientation, mask, mhi, timestamp
FUNCTIONmotempl_calcGlobalOrientation
RETURN TYPEnumber
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Calculates a global motion orientation in a selected region.

motempl_calcGlobalOrientation(orientation: Mat, mask: Mat, mhi: Mat, timestamp: number, duration: number): number;
orientation

Motion gradient orientation image calculated by the function calcMotionGradient

mask

Mask image. It may be a conjunction of a valid gradient mask, also calculated by calcMotionGradient , and the mask of a region whose direction needs to be calculated.

mhi

Motion history image calculated by updateMotionHistory .

timestamp

Timestamp passed to updateMotionHistory .

duration

Maximum duration of a motion track in milliseconds, passed to updateMotionHistory

The function calculates an average motion direction in the selected region and returns the angle between 0 degrees and 360 degrees. The average direction is computed from the weighted orientation histogram, where a recent motion has a larger weight and the motion occurred in the past has a smaller weight, as recorded in mhi .

Returns

The number result.

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.