Skip to content

optflow_calcOpticalFlowDenseRLOF

optflowfunctionOpenCV 5.0.0
import { optflow_calcOpticalFlowDenseRLOF } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSI0, I1, flow, rlofParam
FUNCTIONoptflow_calcOpticalFlowDenseRLOF
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

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.

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.

Note: Note that in output, if no correspondences are found between \a I0 and \a I1, the \a flow is set to 0.

See: optflow::DenseRLOFOpticalFlow, optflow::RLOFOpticalFlowParameter

optflow_calcOpticalFlowDenseRLOF(I0: Mat, I1: Mat, flow: Mat, rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number, epicSigma: number, epicLambda: number, ricSPSize: number, ricSLICType: number, use_post_proc: boolean, fgsLambda: number, fgsSigma: number, use_variational_refinement: boolean): void;
14 available overloads
optflow_calcOpticalFlowDenseRLOF(I0: Mat, I1: Mat, flow: Mat): void;
optflow_calcOpticalFlowDenseRLOF(I0: Mat, I1: Mat, flow: Mat, rlofParam: optflow_RLOFOpticalFlowParameter | null): void;
optflow_calcOpticalFlowDenseRLOF(I0: Mat, I1: Mat, flow: Mat, rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number): void;
optflow_calcOpticalFlowDenseRLOF(I0: Mat, I1: Mat, flow: Mat, rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size): void;
optflow_calcOpticalFlowDenseRLOF(I0: Mat, I1: Mat, flow: Mat, rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number): void;
optflow_calcOpticalFlowDenseRLOF(I0: Mat, I1: Mat, flow: Mat, rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number): void;
optflow_calcOpticalFlowDenseRLOF(I0: Mat, I1: Mat, flow: Mat, rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number, epicSigma: number): void;
optflow_calcOpticalFlowDenseRLOF(I0: Mat, I1: Mat, flow: Mat, rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number, epicSigma: number, epicLambda: number): void;
optflow_calcOpticalFlowDenseRLOF(I0: Mat, I1: Mat, flow: Mat, rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number, epicSigma: number, epicLambda: number, ricSPSize: number): void;
optflow_calcOpticalFlowDenseRLOF(I0: Mat, I1: Mat, flow: Mat, rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number, epicSigma: number, epicLambda: number, ricSPSize: number, ricSLICType: number): void;
optflow_calcOpticalFlowDenseRLOF(I0: Mat, I1: Mat, flow: Mat, rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number, epicSigma: number, epicLambda: number, ricSPSize: number, ricSLICType: number, use_post_proc: boolean): void;
optflow_calcOpticalFlowDenseRLOF(I0: Mat, I1: Mat, flow: Mat, rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number, epicSigma: number, epicLambda: number, ricSPSize: number, ricSLICType: number, use_post_proc: boolean, fgsLambda: number): void;
optflow_calcOpticalFlowDenseRLOF(I0: Mat, I1: Mat, flow: Mat, rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number, epicSigma: number, epicLambda: number, ricSPSize: number, ricSLICType: number, use_post_proc: boolean, fgsLambda: number, fgsSigma: number): void;
optflow_calcOpticalFlowDenseRLOF(I0: Mat, I1: Mat, flow: Mat, rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number, epicSigma: number, epicLambda: number, ricSPSize: number, ricSLICType: number, use_post_proc: boolean, fgsLambda: number, fgsSigma: number, use_variational_refinement: boolean): void;
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

Input/output value, modified by the native operation. 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 \mathbf{x} a motion vector d_{I0,I1}(\mathbf{x}) is computed. If the forward backward error

EP_{FB} = || d_{I0,I1} + d_{I1,I0} || 

is larger than threshold given by this function then the motion vector will not be used by the following vector field interpolation. d_{I1,I0} 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.

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.