OpenCV  4.5.0
Open Source Computer Vision
Public Member Functions | Static Public Member Functions | List of all members
cv::optflow::DenseRLOFOpticalFlow Class Referenceabstract

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

#include <opencv2/optflow/rlofflow.hpp>

Inheritance diagram for cv::optflow::DenseRLOFOpticalFlow:
cv::DenseOpticalFlow cv::Algorithm

Public Member Functions

virtual int getEPICK () const =0
 see ximgproc::EdgeAwareInterpolator() K value. More...
 
virtual float getEPICLambda () const =0
 see ximgproc::EdgeAwareInterpolator() lambda value. More...
 
virtual float getEPICSigma () const =0
 see ximgproc::EdgeAwareInterpolator() sigma value. More...
 
virtual float getFgsLambda () const =0
 see ximgproc::EdgeAwareInterpolator(). More...
 
virtual float getFgsSigma () const =0
 see ximgproc::EdgeAwareInterpolator(). More...
 
virtual float getForwardBackward () const =0
 Threshold for the forward backward confidence check. More...
 
virtual Size getGridStep () const =0
 Size of the grid to spawn the motion vectors. More...
 
virtual InterpolationType getInterpolation () const =0
 Interpolation used to compute the dense optical flow. More...
 
virtual int getRICSLICType () const =0
 Parameter to choose superpixel algorithm variant to use: More...
 
virtual int getRICSPSize () const =0
 Parameter to tune the approximate size of the superpixel used for oversegmentation. More...
 
virtual Ptr< RLOFOpticalFlowParametergetRLOFOpticalFlowParameter () const =0
 Configuration of the RLOF alogrithm. More...
 
virtual bool getUsePostProc () const =0
 enables ximgproc::fastGlobalSmootherFilter More...
 
virtual bool getUseVariationalRefinement () const =0
 enables VariationalRefinement More...
 
virtual void setEPICK (int val)=0
 see ximgproc::EdgeAwareInterpolator() K value. More...
 
virtual void setEPICLambda (float val)=0
 see ximgproc::EdgeAwareInterpolator() lambda value. More...
 
virtual void setEPICSigma (float val)=0
 see ximgproc::EdgeAwareInterpolator() sigma value. More...
 
virtual void setFgsLambda (float val)=0
 see ximgproc::EdgeAwareInterpolator(). More...
 
virtual void setFgsSigma (float val)=0
 see ximgproc::EdgeAwareInterpolator(). More...
 
virtual void setForwardBackward (float val)=0
 Threshold for the forward backward confidence check. More...
 
virtual void setGridStep (Size val)=0
 Size of the grid to spawn the motion vectors. More...
 
virtual void setInterpolation (InterpolationType val)=0
 Interpolation used to compute the dense optical flow. More...
 
virtual void setRICSLICType (int val)=0
 Parameter to choose superpixel algorithm variant to use: More...
 
virtual void setRICSPSize (int val)=0
 Parameter to tune the approximate size of the superpixel used for oversegmentation. More...
 
virtual void setRLOFOpticalFlowParameter (Ptr< RLOFOpticalFlowParameter > val)=0
 Configuration of the RLOF alogrithm. More...
 
virtual void setUsePostProc (bool val)=0
 enables ximgproc::fastGlobalSmootherFilter More...
 
virtual void setUseVariationalRefinement (bool val)=0
 enables VariationalRefinement More...
 
- Public Member Functions inherited from cv::DenseOpticalFlow
virtual void calc (InputArray I0, InputArray I1, InputOutputArray flow)=0
 Calculates an optical flow. More...
 
virtual void collectGarbage ()=0
 Releases all inner buffers. More...
 
- Public Member Functions inherited from cv::Algorithm
 Algorithm ()
 
virtual ~Algorithm ()
 
virtual void clear ()
 Clears the algorithm state. More...
 
virtual bool empty () const
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. More...
 
virtual String getDefaultName () const
 
virtual void read (const FileNode &fn)
 Reads algorithm parameters from a file storage. More...
 
virtual void save (const String &filename) const
 
virtual void write (FileStorage &fs) const
 Stores algorithm parameters in a file storage. More...
 
void write (const Ptr< FileStorage > &fs, const String &name=String()) const
 simplified API for language bindings This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 

Static Public Member Functions

static Ptr< DenseRLOFOpticalFlowcreate (Ptr< RLOFOpticalFlowParameter > rlofParam=Ptr< RLOFOpticalFlowParameter >(), float forwardBackwardThreshold=1.f, Size gridStep=Size(6, 6), InterpolationType interp_type=InterpolationType::INTERP_EPIC, int epicK=128, float epicSigma=0.05f, float epicLambda=999.0f, int ricSPSize=15, int ricSLICType=100, bool use_post_proc=true, float fgsLambda=500.0f, float fgsSigma=1.5f, bool use_variational_refinement=false)
 Creates instance of optflow::DenseRLOFOpticalFlow. More...
 
- Static Public Member Functions inherited from cv::Algorithm
template<typename _Tp >
static Ptr< _Tp > load (const String &filename, const String &objname=String())
 Loads algorithm from the file. More...
 
template<typename _Tp >
static Ptr< _Tp > loadFromString (const String &strModel, const String &objname=String())
 Loads algorithm from a String. More...
 
template<typename _Tp >
static Ptr< _Tp > read (const FileNode &fn)
 Reads algorithm from the file node. More...
 

Additional Inherited Members

- Protected Member Functions inherited from cv::Algorithm
void writeFormat (FileStorage &fs) const
 

Detailed Description

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 [208] [209] [210] and [211] similar to the pyramidal iterative Lucas-Kanade method as proposed by [25]. More details and experiments can be found in the following thesis [212]. The implementation is derived from optflow::calcOpticalFlowPyrLK().

The sparse-to-dense interpolation scheme allows for fast computation of dense optical flow using RLOF (see [84]). For this scheme the following steps are applied:

  1. motion vector seeded at a regular sampled grid are computed. The sparsity of this grid can be configured with setGridStep
  2. (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.
  3. Vector field interpolation is applied to the motion vector set to obtain a dense vector field.

For the RLOF configuration see optflow::RLOFOpticalFlowParameter for further details. Parameters have been described in [208] [209] [210] and [211].

Note
If the grid size is set to (1,1) and the forward backward threshold <= 0 than pixelwise dense optical flow field is computed by RLOF without using interpolation.
See also
optflow::calcOpticalFlowDenseRLOF(), optflow::RLOFOpticalFlowParameter

Member Function Documentation

◆ create()

static Ptr<DenseRLOFOpticalFlow> cv::optflow::DenseRLOFOpticalFlow::create ( Ptr< RLOFOpticalFlowParameter rlofParam = PtrRLOFOpticalFlowParameter >(),
float  forwardBackwardThreshold = 1.f,
Size  gridStep = Size(6, 6),
InterpolationType  interp_type = InterpolationType::INTERP_EPIC,
int  epicK = 128,
float  epicSigma = 0.05f,
float  epicLambda = 999.0f,
int  ricSPSize = 15,
int  ricSLICType = 100,
bool  use_post_proc = true,
float  fgsLambda = 500.0f,
float  fgsSigma = 1.5f,
bool  use_variational_refinement = false 
)
static
Python:
retval=cv.optflow.DenseRLOFOpticalFlow_create([, rlofParam[, forwardBackwardThreshold[, gridStep[, interp_type[, epicK[, epicSigma[, epicLambda[, ricSPSize[, ricSLICType[, use_post_proc[, fgsLambda[, fgsSigma[, use_variational_refinement]]]]]]]]]]]]])

Creates instance of optflow::DenseRLOFOpticalFlow.

Parameters
rlofParamsee optflow::RLOFOpticalFlowParameter
forwardBackwardThresholdsee setForwardBackward
gridStepsee setGridStep
interp_typesee setInterpolation
epicKsee setEPICK
epicSigmasee setEPICSigma
epicLambdasee setEPICLambda
ricSPSizesee setRICSPSize
ricSLICTypesee setRICSLICType
use_post_procsee setUsePostProc
fgsLambdasee setFgsLambda
fgsSigmasee setFgsSigma
use_variational_refinementsee setUseVariationalRefinement

◆ getEPICK()

virtual int cv::optflow::DenseRLOFOpticalFlow::getEPICK ( ) const
pure virtual
Python:
retval=cv.optflow_DenseRLOFOpticalFlow.getEPICK()

see ximgproc::EdgeAwareInterpolator() K value.

K is a number of nearest-neighbor matches considered, when fitting a locally affine model. Usually it should be around 128. However, lower values would make the interpolation noticeably faster.

See also
ximgproc::EdgeAwareInterpolator, setEPICK

◆ getEPICLambda()

virtual float cv::optflow::DenseRLOFOpticalFlow::getEPICLambda ( ) const
pure virtual
Python:
retval=cv.optflow_DenseRLOFOpticalFlow.getEPICLambda()

see ximgproc::EdgeAwareInterpolator() lambda value.

Lambda is a parameter defining the weight of the edge-aware term in geodesic distance, should be in the range of 0 to 1000.

See also
ximgproc::EdgeAwareInterpolator, setEPICSigma

◆ getEPICSigma()

virtual float cv::optflow::DenseRLOFOpticalFlow::getEPICSigma ( ) const
pure virtual
Python:
retval=cv.optflow_DenseRLOFOpticalFlow.getEPICSigma()

see ximgproc::EdgeAwareInterpolator() sigma value.

Sigma is a parameter defining how fast the weights decrease in the locally-weighted affine fitting. Higher values can help preserve fine details, lower values can help to get rid of noise in the output flow.

See also
ximgproc::EdgeAwareInterpolator, setEPICSigma

◆ getFgsLambda()

virtual float cv::optflow::DenseRLOFOpticalFlow::getFgsLambda ( ) const
pure virtual
Python:
retval=cv.optflow_DenseRLOFOpticalFlow.getFgsLambda()

see ximgproc::EdgeAwareInterpolator().

Sets the respective fastGlobalSmootherFilter() parameter.

See also
ximgproc::EdgeAwareInterpolator, setFgsLambda

◆ getFgsSigma()

virtual float cv::optflow::DenseRLOFOpticalFlow::getFgsSigma ( ) const
pure virtual
Python:
retval=cv.optflow_DenseRLOFOpticalFlow.getFgsSigma()

see ximgproc::EdgeAwareInterpolator().

Sets the respective fastGlobalSmootherFilter() parameter.

See also
ximgproc::EdgeAwareInterpolator, ximgproc::fastGlobalSmootherFilter, setFgsSigma

◆ getForwardBackward()

virtual float cv::optflow::DenseRLOFOpticalFlow::getForwardBackward ( ) const
pure virtual
Python:
retval=cv.optflow_DenseRLOFOpticalFlow.getForwardBackward()

Threshold for the forward backward confidence check.

See also
setForwardBackward

◆ getGridStep()

virtual Size cv::optflow::DenseRLOFOpticalFlow::getGridStep ( ) const
pure virtual
Python:
retval=cv.optflow_DenseRLOFOpticalFlow.getGridStep()

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.

See also
getForwardBackward, setGridStep

◆ getInterpolation()

virtual InterpolationType cv::optflow::DenseRLOFOpticalFlow::getInterpolation ( ) const
pure virtual
Python:
retval=cv.optflow_DenseRLOFOpticalFlow.getInterpolation()

Interpolation used to compute the dense optical flow.

See also
ximgproc::EdgeAwareInterpolator, setInterpolation

◆ getRICSLICType()

virtual int cv::optflow::DenseRLOFOpticalFlow::getRICSLICType ( ) const
pure virtual
Python:
retval=cv.optflow_DenseRLOFOpticalFlow.getRICSLICType()

Parameter to choose superpixel algorithm variant to use:

See also
setRICSLICType

◆ getRICSPSize()

virtual int cv::optflow::DenseRLOFOpticalFlow::getRICSPSize ( ) const
pure virtual
Python:
retval=cv.optflow_DenseRLOFOpticalFlow.getRICSPSize()

Parameter to tune the approximate size of the superpixel used for oversegmentation.

See also
setRICSPSize

◆ getRLOFOpticalFlowParameter()

virtual Ptr<RLOFOpticalFlowParameter> cv::optflow::DenseRLOFOpticalFlow::getRLOFOpticalFlowParameter ( ) const
pure virtual
Python:
retval=cv.optflow_DenseRLOFOpticalFlow.getRLOFOpticalFlowParameter()

Configuration of the RLOF alogrithm.

See also
optflow::RLOFOpticalFlowParameter, setRLOFOpticalFlowParameter

◆ getUsePostProc()

virtual bool cv::optflow::DenseRLOFOpticalFlow::getUsePostProc ( ) const
pure virtual
Python:
retval=cv.optflow_DenseRLOFOpticalFlow.getUsePostProc()

◆ getUseVariationalRefinement()

virtual bool cv::optflow::DenseRLOFOpticalFlow::getUseVariationalRefinement ( ) const
pure virtual
Python:
retval=cv.optflow_DenseRLOFOpticalFlow.getUseVariationalRefinement()

◆ setEPICK()

virtual void cv::optflow::DenseRLOFOpticalFlow::setEPICK ( int  val)
pure virtual
Python:
None=cv.optflow_DenseRLOFOpticalFlow.setEPICK(val)

see ximgproc::EdgeAwareInterpolator() K value.

See also
ximgproc::EdgeAwareInterpolator, getEPICK

◆ setEPICLambda()

virtual void cv::optflow::DenseRLOFOpticalFlow::setEPICLambda ( float  val)
pure virtual
Python:
None=cv.optflow_DenseRLOFOpticalFlow.setEPICLambda(val)

see ximgproc::EdgeAwareInterpolator() lambda value.

See also
ximgproc::EdgeAwareInterpolator, getEPICLambda

◆ setEPICSigma()

virtual void cv::optflow::DenseRLOFOpticalFlow::setEPICSigma ( float  val)
pure virtual
Python:
None=cv.optflow_DenseRLOFOpticalFlow.setEPICSigma(val)

see ximgproc::EdgeAwareInterpolator() sigma value.

See also
ximgproc::EdgeAwareInterpolator, getEPICSigma

◆ setFgsLambda()

virtual void cv::optflow::DenseRLOFOpticalFlow::setFgsLambda ( float  val)
pure virtual
Python:
None=cv.optflow_DenseRLOFOpticalFlow.setFgsLambda(val)

see ximgproc::EdgeAwareInterpolator().

See also
ximgproc::EdgeAwareInterpolator, ximgproc::fastGlobalSmootherFilter, getFgsLambda

◆ setFgsSigma()

virtual void cv::optflow::DenseRLOFOpticalFlow::setFgsSigma ( float  val)
pure virtual
Python:
None=cv.optflow_DenseRLOFOpticalFlow.setFgsSigma(val)

see ximgproc::EdgeAwareInterpolator().

See also
ximgproc::EdgeAwareInterpolator, ximgproc::fastGlobalSmootherFilter, getFgsSigma

◆ setForwardBackward()

virtual void cv::optflow::DenseRLOFOpticalFlow::setForwardBackward ( float  val)
pure virtual
Python:
None=cv.optflow_DenseRLOFOpticalFlow.setForwardBackward(val)

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.

See also
getForwardBackward, setGridStep

◆ setGridStep()

virtual void cv::optflow::DenseRLOFOpticalFlow::setGridStep ( Size  val)
pure virtual
Python:
None=cv.optflow_DenseRLOFOpticalFlow.setGridStep(val)

Size of the grid to spawn the motion vectors.

See also
getGridStep

◆ setInterpolation()

virtual void cv::optflow::DenseRLOFOpticalFlow::setInterpolation ( InterpolationType  val)
pure virtual
Python:
None=cv.optflow_DenseRLOFOpticalFlow.setInterpolation(val)

Interpolation used to compute the dense optical flow.

Two interpolation algorithms are supported

◆ setRICSLICType()

virtual void cv::optflow::DenseRLOFOpticalFlow::setRICSLICType ( int  val)
pure virtual
Python:
None=cv.optflow_DenseRLOFOpticalFlow.setRICSLICType(val)

Parameter to choose superpixel algorithm variant to use:

◆ setRICSPSize()

virtual void cv::optflow::DenseRLOFOpticalFlow::setRICSPSize ( int  val)
pure virtual
Python:
None=cv.optflow_DenseRLOFOpticalFlow.setRICSPSize(val)

Parameter to tune the approximate size of the superpixel used for oversegmentation.

See also
cv::ximgproc::createSuperpixelSLIC, cv::ximgproc::RICInterpolator

◆ setRLOFOpticalFlowParameter()

virtual void cv::optflow::DenseRLOFOpticalFlow::setRLOFOpticalFlowParameter ( Ptr< RLOFOpticalFlowParameter val)
pure virtual
Python:
None=cv.optflow_DenseRLOFOpticalFlow.setRLOFOpticalFlowParameter(val)

Configuration of the RLOF alogrithm.

See also
optflow::RLOFOpticalFlowParameter, getRLOFOpticalFlowParameter

◆ setUsePostProc()

virtual void cv::optflow::DenseRLOFOpticalFlow::setUsePostProc ( bool  val)
pure virtual
Python:
None=cv.optflow_DenseRLOFOpticalFlow.setUsePostProc(val)

◆ setUseVariationalRefinement()

virtual void cv::optflow::DenseRLOFOpticalFlow::setUseVariationalRefinement ( bool  val)
pure virtual
Python:
None=cv.optflow_DenseRLOFOpticalFlow.setUseVariationalRefinement(val)

The documentation for this class was generated from the following file: