motempl_calcMotionGradient
import { motempl_calcMotionGradient } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Calculates a gradient orientation of a motion history image.
Note: - (Python) An example on how to perform a motion template technique can be found at opencv_source_code/samples/python2/motempl.py
motempl_calcMotionGradient(mhi: Mat, mask: Mat, orientation: Mat, delta1: number, delta2: number, apertureSize: number): void;2 available overloads
motempl_calcMotionGradient(mhi: Mat, mask: Mat, orientation: Mat, delta1: number, delta2: number): void;motempl_calcMotionGradient(mhi: Mat, mask: Mat, orientation: Mat, delta1: number, delta2: number, apertureSize: number): void;mhiMotion history single-channel floating-point image.
maskOutput destination, filled by the native operation. Output mask image that has the type CV_8UC1 and the same size as mhi . Its non-zero elements mark pixels where the motion gradient data is correct.
orientationOutput destination, filled by the native operation. Output motion gradient orientation image that has the same type and the same size as mhi . Each pixel of the image is a motion orientation, from 0 to 360 degrees.
delta1Minimal (or maximal) allowed difference between mhi values within a pixel neighborhood.
delta2Maximal (or minimal) allowed difference between mhi values within a pixel neighborhood. That is, the function finds the minimum (
m(x,y)) and maximum (M(x,y)) mhi values over3 \times 3neighborhood of each pixel and marks the motion orientation at(x, y)as valid only if\min ( \texttt{delta1} , \texttt{delta2} ) \le M(x,y)-m(x,y) \le \max ( \texttt{delta1} , \texttt{delta2} ).apertureSizeAperture size of the Sobel operator.
The function calculates a gradient orientation at each pixel
(x, y)as:\texttt{orientation} (x,y)= \arctan{\frac{d\texttt{mhi}/dy}{d\texttt{mhi}/dx}}In fact, fastAtan2 and phase are used so that the computed angle is measured in degrees and covers the full range 0..360. Also, the mask is filled to indicate pixels where the computed angle is valid.
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.