[][src]Function opencv::optflow::calc_optical_flow_dense_rlof

pub fn calc_optical_flow_dense_rlof(
    i0: &dyn ToInputArray,
    i1: &dyn ToInputArray,
    flow: &mut dyn ToInputOutputArray,
    rlof_param: Ptr<RLOFOpticalFlowParameter>,
    forward_backward_threshold: f32,
    grid_step: Size,
    interp_type: InterpolationType,
    epic_k: i32,
    epic_sigma: f32,
    epic_lambda: f32,
    ric_sp_size: i32,
    ric_slic_type: i32,
    use_post_proc: bool,
    fgs_lambda: f32,
    fgs_sigma: f32,
    use_variational_refinement: bool
) -> Result<()>

Fast dense optical flow computation based on robust local optical flow (RLOF) algorithms and sparse-to-dense interpolation scheme.

The RLOF is a fast local optical flow approach described in Senst2012 Senst2013 Senst2014 and Senst2016 similar to the pyramidal iterative Lucas-Kanade method as proposed by Bouguet00. More details and experiments can be found in the following thesis Senst2019. The implementation is derived from optflow::calcOpticalFlowPyrLK().

The sparse-to-dense interpolation scheme allows for fast computation of dense optical flow using RLOF (see Geistert2016). For this scheme the following steps are applied: -# motion vector seeded at a regular sampled grid are computed. The sparsity of this grid can be configured with setGridStep -# (optinally) errornous motion vectors are filter based on the forward backward confidence. The threshold can be configured with setForwardBackward. The filter is only applied if the threshold >0 but than the runtime is doubled due to the estimation of the backward flow. -# Vector field interpolation is applied to the motion vector set to obtain a dense vector field.

Parameters

  • I0: first 8-bit input image. If The cross-based RLOF is used (by selecting optflow::RLOFOpticalFlowParameter::supportRegionType = SupportRegionType::SR_CROSS) image has to be a 8-bit 3 channel image.
  • I1: second 8-bit input image. If The cross-based RLOF is used (by selecting optflow::RLOFOpticalFlowParameter::supportRegionType = SupportRegionType::SR_CROSS) image has to be a 8-bit 3 channel image.
  • flow: computed flow image that has the same size as I0 and type CV_32FC2.
  • rlofParam: see optflow::RLOFOpticalFlowParameter
  • forwardBackwardThreshold: Threshold for the forward backward confidence check. For each grid point inline formula a motion vector inline formula is computed. If the forward backward error block formula is larger than threshold given by this function then the motion vector will not be used by the following vector field interpolation. inline formula denotes the backward flow. Note, the forward backward test will only be applied if the threshold > 0. This may results into a doubled runtime for the motion estimation.
  • gridStep: Size of the grid to spawn the motion vectors. For each grid point a motion vector is computed. Some motion vectors will be removed due to the forwatd backward threshold (if set >0). The rest will be the base of the vector field interpolation.
  • interp_type: interpolation method used to compute the dense optical flow. Two interpolation algorithms are supported:
  • INTERP_GEO applies the fast geodesic interpolation, see Geistert2016.
  • INTERP_EPIC_RESIDUAL applies the edge-preserving interpolation, see Revaud2015,Geistert2016.
  • epicK: see ximgproc::EdgeAwareInterpolator sets the respective parameter.
  • epicSigma: see ximgproc::EdgeAwareInterpolator sets the respective parameter.
  • epicLambda: see ximgproc::EdgeAwareInterpolator sets the respective parameter.
  • ricSPSize: see ximgproc::RICInterpolator sets the respective parameter.
  • ricSLICType: see ximgproc::RICInterpolator sets the respective parameter.
  • use_post_proc: enables ximgproc::fastGlobalSmootherFilter() parameter.
  • fgsLambda: sets the respective ximgproc::fastGlobalSmootherFilter() parameter.
  • fgsSigma: sets the respective ximgproc::fastGlobalSmootherFilter() parameter.
  • use_variational_refinement: enables VariationalRefinement

Parameters have been described in Senst2012, Senst2013, Senst2014, Senst2016. For the RLOF configuration see optflow::RLOFOpticalFlowParameter for further details.

Note: If the grid size is set to (1,1) and the forward backward threshold <= 0 that the dense optical flow field is purely computed with the RLOF.

Note: SIMD parallelization is only available when compiling with SSE4.1.

See also

optflow::DenseRLOFOpticalFlow, optflow::RLOFOpticalFlowParameter

C++ default parameters

  • rlof_param: Ptr()
  • forward_backward_threshold: 0
  • grid_step: Size(6,6)
  • interp_type: InterpolationType::INTERP_EPIC
  • epic_k: 128
  • epic_sigma: 0.05f
  • epic_lambda: 100.f
  • ric_sp_size: 15
  • ric_slic_type: 100
  • use_post_proc: true
  • fgs_lambda: 500.0f
  • fgs_sigma: 1.5f
  • use_variational_refinement: false