cv::optflow::DenseRLOFOpticalFlow Class ReferenceabstractOptical Flow Algorithms Примеры с cv2.imshow требуют сборки OpenCV с GUI. В ноутбуке с headless-версией используйте вывод изображений через Matplotlib.
cv::optflow::DenseRLOFOpticalFlow Class Reference
abstract
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>
Collaboration diagram for cv::optflow::DenseRLOFOpticalFlow:
The documentation for this class was generated from the following file:
see ximgproc::EdgeAwareInterpolator() K value.
see ximgproc::EdgeAwareInterpolator() lambda value.
see ximgproc::EdgeAwareInterpolator() sigma value.
see ximgproc::EdgeAwareInterpolator().
see ximgproc::EdgeAwareInterpolator().
Threshold for the forward backward confidence check.
Size of the grid to spawn the motion vectors.
Interpolation used to compute the dense optical flow.
Parameter to choose superpixel algorithm variant to use:
Parameter to tune the approximate size of the superpixel used for oversegmentation.
Configuration of the RLOF alogrithm.
see ximgproc::EdgeAwareInterpolator() K value.
see ximgproc::EdgeAwareInterpolator() lambda value.
see ximgproc::EdgeAwareInterpolator() sigma value.
see ximgproc::EdgeAwareInterpolator().
see ximgproc::EdgeAwareInterpolator().
Threshold for the forward backward confidence check.
Size of the grid to spawn the motion vectors.
Interpolation used to compute the dense optical flow.
Parameter to choose superpixel algorithm variant to use:
Parameter to tune the approximate size of the superpixel used for oversegmentation.
Configuration of the RLOF alogrithm.
Calculates an optical flow.
Releases all inner buffers.
Clears the algorithm state.
virtual bool empty () const
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.
Reads algorithm parameters from a file storage.
Stores algorithm parameters in a file storage.
Static Public Member Functionsstatic Ptr < 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 . 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. template<typename _Tp > static Ptr < _Tp > loadFromString (const String &strModel, const String &objname=String ()) Loads algorithm from a String. template<typename _Tp > static Ptr < _Tp > read (const FileNode &fn) Reads algorithm from the file node.
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 [244] [245] [246] and [247] similar to the pyramidal iterative Lucas-Kanade method as proposed by [38] . More details and experiments can be found in the following thesis [248] . The implementation is derived from optflow::calcOpticalFlowPyrLK().
The sparse-to-dense interpolation scheme allows for fast computation of dense optical flow using RLOF (see [105] ). 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.
For the RLOF configuration see optflow::RLOFOpticalFlowParameter for further details. Parameters have been described in [244] [245] [246] and [247] .
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 that in output, if no correspondences are found between I0 and I1 , the flow is set to 0.
Member Function Documentation
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 )
static
Python: cv.optflow.DenseRLOFOpticalFlow.create( [, rlofParam[, forwardBackwardThreshold[, gridStep[, interp_type[, epicK[, epicSigma[, epicLambda[, ricSPSize[, ricSLICType[, use_post_proc[, fgsLambda[, fgsSigma[, use_variational_refinement]]]]]]]]]]]]] ) -> retval cv.optflow.DenseRLOFOpticalFlow_create( [, rlofParam[, forwardBackwardThreshold[, gridStep[, interp_type[, epicK[, epicSigma[, epicLambda[, ricSPSize[, ricSLICType[, use_post_proc[, fgsLambda[, fgsSigma[, use_variational_refinement]]]]]]]]]]]]] ) -> retval
getEPICK()
virtual int cv::optflow::DenseRLOFOpticalFlow::getEPICK ( ) const
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.getEPICK( ) -> retval
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()
virtual float cv::optflow::DenseRLOFOpticalFlow::getEPICLambda ( ) const
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.getEPICLambda( ) -> retval
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()
virtual float cv::optflow::DenseRLOFOpticalFlow::getEPICSigma ( ) const
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.getEPICSigma( ) -> retval
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()
virtual float cv::optflow::DenseRLOFOpticalFlow::getFgsLambda ( ) const
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.getFgsLambda( ) -> retval
see ximgproc::EdgeAwareInterpolator().
Sets the respective fastGlobalSmootherFilter() parameter.
getFgsSigma()
virtual float cv::optflow::DenseRLOFOpticalFlow::getFgsSigma ( ) const
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.getFgsSigma( ) -> retval
see ximgproc::EdgeAwareInterpolator().
Sets the respective fastGlobalSmootherFilter() parameter.
getForwardBackward()
virtual float cv::optflow::DenseRLOFOpticalFlow::getForwardBackward ( ) const
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.getForwardBackward( ) -> retval
Threshold for the forward backward confidence check.
getGridStep()
virtual Size cv::optflow::DenseRLOFOpticalFlow::getGridStep ( ) const
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.getGridStep( ) -> retval
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()
virtual InterpolationType cv::optflow::DenseRLOFOpticalFlow::getInterpolation ( ) const
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.getInterpolation( ) -> retval
Interpolation used to compute the dense optical flow.
getRICSLICType()
virtual int cv::optflow::DenseRLOFOpticalFlow::getRICSLICType ( ) const
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.getRICSLICType( ) -> retval
Parameter to choose superpixel algorithm variant to use:
getRICSPSize()
virtual int cv::optflow::DenseRLOFOpticalFlow::getRICSPSize ( ) const
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.getRICSPSize( ) -> retval
Parameter to tune the approximate size of the superpixel used for oversegmentation.
getRLOFOpticalFlowParameter()
Python: cv.optflow.DenseRLOFOpticalFlow.getRLOFOpticalFlowParameter( ) -> retval
Configuration of the RLOF alogrithm.
getUsePostProc()
virtual bool cv::optflow::DenseRLOFOpticalFlow::getUsePostProc ( ) const
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.getUsePostProc( ) -> retval
getUseVariationalRefinement()
virtual bool cv::optflow::DenseRLOFOpticalFlow::getUseVariationalRefinement ( ) const
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.getUseVariationalRefinement( ) -> retval
setEPICK()
virtual void cv::optflow::DenseRLOFOpticalFlow::setEPICK ( int val )
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.setEPICK( val ) -> None
see ximgproc::EdgeAwareInterpolator() K value.
setEPICLambda()
virtual void cv::optflow::DenseRLOFOpticalFlow::setEPICLambda ( float val )
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.setEPICLambda( val ) -> None
see ximgproc::EdgeAwareInterpolator() lambda value.
setEPICSigma()
virtual void cv::optflow::DenseRLOFOpticalFlow::setEPICSigma ( float val )
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.setEPICSigma( val ) -> None
see ximgproc::EdgeAwareInterpolator() sigma value.
setFgsLambda()
virtual void cv::optflow::DenseRLOFOpticalFlow::setFgsLambda ( float val )
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.setFgsLambda( val ) -> None
see ximgproc::EdgeAwareInterpolator().
setFgsSigma()
virtual void cv::optflow::DenseRLOFOpticalFlow::setFgsSigma ( float val )
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.setFgsSigma( val ) -> None
see ximgproc::EdgeAwareInterpolator().
setForwardBackward()
virtual void cv::optflow::DenseRLOFOpticalFlow::setForwardBackward ( float val )
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.setForwardBackward( val ) -> None
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
E P F B = ∣ ∣ d I 0 , I 1 + d I 1 , I 0 ∣ ∣ EP_{FB} = || d_{I0,I1} + d_{I1,I0} || E P F B = ∣∣ d I 0 , I 1 + d I 1 , I 0 ∣∣
setGridStep()
virtual void cv::optflow::DenseRLOFOpticalFlow::setGridStep ( Size val )
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.setGridStep( val ) -> None
Size of the grid to spawn the motion vectors.
setInterpolation()
virtual void cv::optflow::DenseRLOFOpticalFlow::setInterpolation ( InterpolationType val )
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.setInterpolation( val ) -> None
Interpolation used to compute the dense optical flow.
Two interpolation algorithms are supported
INTERP_GEO applies the fast geodesic interpolation, see [105] .
INTERP_EPIC_RESIDUAL applies the edge-preserving interpolation, see [231] ,Geistert2016.
setRICSLICType()
virtual void cv::optflow::DenseRLOFOpticalFlow::setRICSLICType ( int val )
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.setRICSLICType( val ) -> None
Parameter to choose superpixel algorithm variant to use:
setRICSPSize()
virtual void cv::optflow::DenseRLOFOpticalFlow::setRICSPSize ( int val )
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.setRICSPSize( val ) -> None
Parameter to tune the approximate size of the superpixel used for oversegmentation.
setRLOFOpticalFlowParameter()
Python: cv.optflow.DenseRLOFOpticalFlow.setRLOFOpticalFlowParameter( val ) -> None
Configuration of the RLOF alogrithm.
setUsePostProc()
virtual void cv::optflow::DenseRLOFOpticalFlow::setUsePostProc ( bool val )
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.setUsePostProc( val ) -> None
setUseVariationalRefinement()
virtual void cv::optflow::DenseRLOFOpticalFlow::setUseVariationalRefinement ( bool val )
pure virtual
Python: cv.optflow.DenseRLOFOpticalFlow.setUseVariationalRefinement( val ) -> None
epicSigma see setEPICSigma
epicLambda see setEPICLambda
ricSPSize see setRICSPSize
ricSLICType see setRICSLICType
use_post_proc see setUsePostProc
fgsLambda see setFgsLambda
use_variational_refinement see setUseVariationalRefinement
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.