Package org.opencv.video
Class DISOpticalFlow
java.lang.Object
org.opencv.core.Algorithm
org.opencv.video.DenseOpticalFlow
org.opencv.video.DISOpticalFlow
public class DISOpticalFlow extends DenseOpticalFlow
DIS optical flow algorithm.
This class implements the Dense Inverse Search (DIS) optical flow algorithm. More
details about the algorithm can be found at CITE: Kroeger2016 . Includes three presets with preselected
parameters to provide reasonable trade-off between speed and quality. However, even the slowest preset is
still relatively fast, use DeepFlow if you need better quality and don't care about speed.
This implementation includes several additional features compared to the algorithm described in the paper,
including spatial propagation of flow vectors (REF: getUseSpatialPropagation), as well as an option to
utilize an initial flow approximation passed to REF: calc (which is, essentially, temporal propagation,
if the previous frame's flow field is passed).
-
Field Summary
Fields Modifier and Type Field Description static int
PRESET_FAST
static int
PRESET_MEDIUM
static int
PRESET_ULTRAFAST
-
Constructor Summary
Constructors Modifier Constructor Description protected
DISOpticalFlow(long addr)
-
Method Summary
Modifier and Type Method Description static DISOpticalFlow
__fromPtr__(long addr)
static DISOpticalFlow
create()
Creates an instance of DISOpticalFlowstatic DISOpticalFlow
create(int preset)
Creates an instance of DISOpticalFlowprotected void
finalize()
int
getFinestScale()
Finest level of the Gaussian pyramid on which the flow is computed (zero level corresponds to the original image resolution).int
getGradientDescentIterations()
Maximum number of gradient descent iterations in the patch inverse search stage.int
getPatchSize()
Size of an image patch for matching (in pixels).int
getPatchStride()
Stride between neighbor patches.boolean
getUseMeanNormalization()
Whether to use mean-normalization of patches when computing patch distance.boolean
getUseSpatialPropagation()
Whether to use spatial propagation of good optical flow vectors.float
getVariationalRefinementAlpha()
Weight of the smoothness term SEE: setVariationalRefinementAlphafloat
getVariationalRefinementDelta()
Weight of the color constancy term SEE: setVariationalRefinementDeltafloat
getVariationalRefinementGamma()
Weight of the gradient constancy term SEE: setVariationalRefinementGammaint
getVariationalRefinementIterations()
Number of fixed point iterations of variational refinement per scale.void
setFinestScale(int val)
getFinestScale SEE: getFinestScalevoid
setGradientDescentIterations(int val)
getGradientDescentIterations SEE: getGradientDescentIterationsvoid
setPatchSize(int val)
getPatchSize SEE: getPatchSizevoid
setPatchStride(int val)
getPatchStride SEE: getPatchStridevoid
setUseMeanNormalization(boolean val)
getUseMeanNormalization SEE: getUseMeanNormalizationvoid
setUseSpatialPropagation(boolean val)
getUseSpatialPropagation SEE: getUseSpatialPropagationvoid
setVariationalRefinementAlpha(float val)
getVariationalRefinementAlpha SEE: getVariationalRefinementAlphavoid
setVariationalRefinementDelta(float val)
getVariationalRefinementDelta SEE: getVariationalRefinementDeltavoid
setVariationalRefinementGamma(float val)
getVariationalRefinementGamma SEE: getVariationalRefinementGammavoid
setVariationalRefinementIterations(int val)
getGradientDescentIterations SEE: getGradientDescentIterationsMethods inherited from class org.opencv.core.Algorithm
clear, empty, getDefaultName, getNativeObjAddr, save
-
Field Details
-
PRESET_ULTRAFAST
- See Also:
- Constant Field Values
-
PRESET_FAST
- See Also:
- Constant Field Values
-
PRESET_MEDIUM
- See Also:
- Constant Field Values
-
-
Constructor Details
-
Method Details
-
__fromPtr__
-
getFinestScale
Finest level of the Gaussian pyramid on which the flow is computed (zero level corresponds to the original image resolution). The final flow is obtained by bilinear upscaling. SEE: setFinestScale- Returns:
- automatically generated
-
setFinestScale
getFinestScale SEE: getFinestScale- Parameters:
val
- automatically generated
-
getPatchSize
Size of an image patch for matching (in pixels). Normally, default 8x8 patches work well enough in most cases. SEE: setPatchSize- Returns:
- automatically generated
-
setPatchSize
getPatchSize SEE: getPatchSize- Parameters:
val
- automatically generated
-
getPatchStride
Stride between neighbor patches. Must be less than patch size. Lower values correspond to higher flow quality. SEE: setPatchStride- Returns:
- automatically generated
-
setPatchStride
getPatchStride SEE: getPatchStride- Parameters:
val
- automatically generated
-
getGradientDescentIterations
Maximum number of gradient descent iterations in the patch inverse search stage. Higher values may improve quality in some cases. SEE: setGradientDescentIterations- Returns:
- automatically generated
-
setGradientDescentIterations
getGradientDescentIterations SEE: getGradientDescentIterations- Parameters:
val
- automatically generated
-
getVariationalRefinementIterations
Number of fixed point iterations of variational refinement per scale. Set to zero to disable variational refinement completely. Higher values will typically result in more smooth and high-quality flow. SEE: setGradientDescentIterations- Returns:
- automatically generated
-
setVariationalRefinementIterations
getGradientDescentIterations SEE: getGradientDescentIterations- Parameters:
val
- automatically generated
-
getVariationalRefinementAlpha
Weight of the smoothness term SEE: setVariationalRefinementAlpha- Returns:
- automatically generated
-
setVariationalRefinementAlpha
getVariationalRefinementAlpha SEE: getVariationalRefinementAlpha- Parameters:
val
- automatically generated
-
getVariationalRefinementDelta
Weight of the color constancy term SEE: setVariationalRefinementDelta- Returns:
- automatically generated
-
setVariationalRefinementDelta
getVariationalRefinementDelta SEE: getVariationalRefinementDelta- Parameters:
val
- automatically generated
-
getVariationalRefinementGamma
Weight of the gradient constancy term SEE: setVariationalRefinementGamma- Returns:
- automatically generated
-
setVariationalRefinementGamma
getVariationalRefinementGamma SEE: getVariationalRefinementGamma- Parameters:
val
- automatically generated
-
getUseMeanNormalization
Whether to use mean-normalization of patches when computing patch distance. It is turned on by default as it typically provides a noticeable quality boost because of increased robustness to illumination variations. Turn it off if you are certain that your sequence doesn't contain any changes in illumination. SEE: setUseMeanNormalization- Returns:
- automatically generated
-
setUseMeanNormalization
getUseMeanNormalization SEE: getUseMeanNormalization- Parameters:
val
- automatically generated
-
getUseSpatialPropagation
Whether to use spatial propagation of good optical flow vectors. This option is turned on by default, as it tends to work better on average and can sometimes help recover from major errors introduced by the coarse-to-fine scheme employed by the DIS optical flow algorithm. Turning this option off can make the output flow field a bit smoother, however. SEE: setUseSpatialPropagation- Returns:
- automatically generated
-
setUseSpatialPropagation
getUseSpatialPropagation SEE: getUseSpatialPropagation- Parameters:
val
- automatically generated
-
create
Creates an instance of DISOpticalFlow- Parameters:
preset
- one of PRESET_ULTRAFAST, PRESET_FAST and PRESET_MEDIUM- Returns:
- automatically generated
-
create
Creates an instance of DISOpticalFlow- Returns:
- automatically generated
-
finalize
- Overrides:
finalize
in classDenseOpticalFlow
- Throws:
Throwable
-