Class cv::optflow::DenseRLOFOpticalFlow#

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

Collaboration diagram for cv::optflow::DenseRLOFOpticalFlow:

Public Member Functions#

Public Member Functions inherited from cv::DenseOpticalFlow

Return

Name

Description

void

calc(
    InputArray I0,
    InputArray I1,
    InputOutputArray flow )

Calculates an optical flow.

void

collectGarbage()

Releases all inner buffers.

Public Member Functions inherited from cv::Algorithm

Return

Name

Description

Algorithm()

~Algorithm()

void

clear()

Clears the algorithm state.

bool

empty()

Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.

String

getDefaultName()

void

read(const FileNode & fn)

Reads algorithm parameters from a file storage.

void

save(const String & filename)

void

write(
    const Ptr< FileStorage > & fs,
    const String & name = String() )

void

write(FileStorage & fs)

Stores algorithm parameters in a file storage.

void

write(
    FileStorage & fs,
    const String & name )

Static Public Member Functions#

Static Public Member Functions inherited from cv::Algorithm

Return

Name

Description

static Ptr< _Tp >

load(
    const String & filename,
    const String & objname = String() )

Loads algorithm from the file.

static Ptr< _Tp >

loadFromString(
    const String & strModel,
    const String & objname = String() )

Loads algorithm from a String.

static Ptr< _Tp >

read(const FileNode & fn)

Reads algorithm from the file node.

Additional Inherited Members#

Protected Member Functions inherited from cv::Algorithm

Return

Name

Description

void

writeFormat(FileStorage & fs)

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 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:

  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 Senst2012 Senst2013 Senst2014 and Senst2016.

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.

Note

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

Member Function Documentation#

getEPICK()#

int 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.

getEPICLambda()#

float 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.

getEPICSigma()#

float 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.

getFgsLambda()#

float cv::optflow::DenseRLOFOpticalFlow::getFgsLambda()

see ximgproc::EdgeAwareInterpolator().

Sets the respective fastGlobalSmootherFilter() parameter.

getFgsSigma()#

float cv::optflow::DenseRLOFOpticalFlow::getFgsSigma()

see ximgproc::EdgeAwareInterpolator().

Sets the respective fastGlobalSmootherFilter() parameter.

getForwardBackward()#

float cv::optflow::DenseRLOFOpticalFlow::getForwardBackward()

Threshold for the forward backward confidence check.

getGridStep()#

Size 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.

getInterpolation()#

InterpolationType cv::optflow::DenseRLOFOpticalFlow::getInterpolation()

Interpolation used to compute the dense optical flow.

getRICSLICType()#

int cv::optflow::DenseRLOFOpticalFlow::getRICSLICType()

Parameter to choose superpixel algorithm variant to use:

See also

setRICSLICType

getRICSPSize()#

int cv::optflow::DenseRLOFOpticalFlow::getRICSPSize()

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

See also

setRICSPSize

getRLOFOpticalFlowParameter()#

Ptr< RLOFOpticalFlowParameter > cv::optflow::DenseRLOFOpticalFlow::getRLOFOpticalFlowParameter()

Configuration of the RLOF alogrithm.

getUsePostProc()#

bool cv::optflow::DenseRLOFOpticalFlow::getUsePostProc()

enables ximgproc::fastGlobalSmootherFilter

getUseVariationalRefinement()#

bool cv::optflow::DenseRLOFOpticalFlow::getUseVariationalRefinement()

enables VariationalRefinement

setEPICK()#

void cv::optflow::DenseRLOFOpticalFlow::setEPICK(int val)

see ximgproc::EdgeAwareInterpolator() K value.

setEPICLambda()#

void cv::optflow::DenseRLOFOpticalFlow::setEPICLambda(float val)

see ximgproc::EdgeAwareInterpolator() lambda value.

setEPICSigma()#

void cv::optflow::DenseRLOFOpticalFlow::setEPICSigma(float val)

see ximgproc::EdgeAwareInterpolator() sigma value.

setFgsLambda()#

void cv::optflow::DenseRLOFOpticalFlow::setFgsLambda(float val)

see ximgproc::EdgeAwareInterpolator().

setFgsSigma()#

void cv::optflow::DenseRLOFOpticalFlow::setFgsSigma(float val)

see ximgproc::EdgeAwareInterpolator().

setForwardBackward()#

void cv::optflow::DenseRLOFOpticalFlow::setForwardBackward(float 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.

setGridStep()#

void cv::optflow::DenseRLOFOpticalFlow::setGridStep(Size val)

Size of the grid to spawn the motion vectors.

See also

getGridStep

setInterpolation()#

void cv::optflow::DenseRLOFOpticalFlow::setInterpolation(InterpolationType val)

Interpolation used to compute the dense optical flow.

Two interpolation algorithms are supported

  • INTERP_GEO applies the fast geodesic interpolation, see [115].

  • INTERP_EPIC_RESIDUAL applies the edge-preserving interpolation, see [250],[115].

setRICSLICType()#

void cv::optflow::DenseRLOFOpticalFlow::setRICSLICType(int val)

Parameter to choose superpixel algorithm variant to use:

setRICSPSize()#

void cv::optflow::DenseRLOFOpticalFlow::setRICSPSize(int val)

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

setRLOFOpticalFlowParameter()#

void cv::optflow::DenseRLOFOpticalFlow::setRLOFOpticalFlowParameter(Ptr< RLOFOpticalFlowParameter > val)

Configuration of the RLOF alogrithm.

setUsePostProc()#

void cv::optflow::DenseRLOFOpticalFlow::setUsePostProc(bool val)

enables ximgproc::fastGlobalSmootherFilter

See also

getUsePostProc

setUseVariationalRefinement()#

void cv::optflow::DenseRLOFOpticalFlow::setUseVariationalRefinement(bool val)

enables VariationalRefinement

create()#

static Ptr< DenseRLOFOpticalFlow > cv::optflow::DenseRLOFOpticalFlow::create(
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.

Parameters

  • rlofParam — see optflow::RLOFOpticalFlowParameter

  • forwardBackwardThreshold — see setForwardBackward

  • gridStep — see setGridStep

  • interp_type — see setInterpolation

  • epicK — see setEPICK

  • epicSigma — see setEPICSigma

  • epicLambda — see setEPICLambda

  • ricSPSize — see setRICSPSize

  • ricSLICType — see setRICSLICType

  • use_post_proc — see setUsePostProc

  • fgsLambda — see setFgsLambda

  • fgsSigma — see setFgsSigma

  • use_variational_refinement — see setUseVariationalRefinement

Source file#

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