opencv::optflow

Function update_motion_history

Source
pub fn update_motion_history(
    silhouette: &impl ToInputArray,
    mhi: &mut impl ToInputOutputArray,
    timestamp: f64,
    duration: f64,
) -> Result<()>
Expand description

Updates the motion history image by a moving silhouette.

ยงParameters

  • silhouette: Silhouette mask that has non-zero pixels where the motion occurs.
  • mhi: Motion history image that is updated by the function (single-channel, 32-bit floating-point).
  • timestamp: Current time in milliseconds or other units.
  • duration: Maximal duration of the motion track in the same units as timestamp .

The function updates the motion history image as follows:

block formula

That is, MHI pixels where the motion occurs are set to the current timestamp , while the pixels where the motion happened last time a long time ago are cleared.

The function, together with calcMotionGradient and calcGlobalOrientation , implements a motion templates technique described in Davis97 and Bradski00 .