[][src]Function opencv::optflow::calc_motion_gradient

pub fn calc_motion_gradient(
    mhi: &dyn ToInputArray,
    mask: &mut dyn ToOutputArray,
    orientation: &mut dyn ToOutputArray,
    delta1: f64,
    delta2: f64,
    aperture_size: i32
) -> Result<()>

Calculates a gradient orientation of a motion history image.

Parameters

  • mhi: Motion history single-channel floating-point image.
  • mask: 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.
  • orientation: 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.
  • delta1: Minimal (or maximal) allowed difference between mhi values within a pixel neighborhood.
  • delta2: Maximal (or minimal) allowed difference between mhi values within a pixel neighborhood. That is, the function finds the minimum ( inline formula ) and maximum ( inline formula ) mhi values over inline formula neighborhood of each pixel and marks the motion orientation at inline formula as valid only if block formula
  • apertureSize: Aperture size of the Sobel operator.

The function calculates a gradient orientation at each pixel inline formula as:

block formula

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.

Note:

  • (Python) An example on how to perform a motion template technique can be found at opencv_source_code/samples/python2/motempl.py

C++ default parameters

  • aperture_size: 3