motempl_calcGlobalOrientation
import { motempl_calcGlobalOrientation } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Calculates a global motion orientation in a selected region.
motempl_calcGlobalOrientation(orientation: Mat, mask: Mat, mhi: Mat, timestamp: number, duration: number): number;orientationMotion gradient orientation image calculated by the function calcMotionGradient
maskMask 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.
mhiMotion history image calculated by updateMotionHistory .
timestampTimestamp passed to updateMotionHistory .
durationMaximum 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 .
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.