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
All Methods Static Methods Instance Methods Concrete Methods 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: getGradientDescentIterations-
Methods inherited from class org.opencv.video.DenseOpticalFlow
calc, collectGarbage
-
Methods inherited from class org.opencv.core.Algorithm
clear, empty, getDefaultName, getNativeObjAddr, save
-
-
-
-
Field Detail
-
PRESET_ULTRAFAST
public static final int PRESET_ULTRAFAST
- See Also:
- Constant Field Values
-
PRESET_FAST
public static final int PRESET_FAST
- See Also:
- Constant Field Values
-
PRESET_MEDIUM
public static final int PRESET_MEDIUM
- See Also:
- Constant Field Values
-
-
Method Detail
-
__fromPtr__
public static DISOpticalFlow __fromPtr__(long addr)
-
create
public static DISOpticalFlow create(int preset)
Creates an instance of DISOpticalFlow- Parameters:
preset
- one of PRESET_ULTRAFAST, PRESET_FAST and PRESET_MEDIUM- Returns:
- automatically generated
-
create
public static DISOpticalFlow create()
Creates an instance of DISOpticalFlow- Returns:
- automatically generated
-
getUseMeanNormalization
public boolean 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
-
getUseSpatialPropagation
public boolean 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
-
getVariationalRefinementAlpha
public float getVariationalRefinementAlpha()
Weight of the smoothness term SEE: setVariationalRefinementAlpha- Returns:
- automatically generated
-
getVariationalRefinementDelta
public float getVariationalRefinementDelta()
Weight of the color constancy term SEE: setVariationalRefinementDelta- Returns:
- automatically generated
-
getVariationalRefinementGamma
public float getVariationalRefinementGamma()
Weight of the gradient constancy term SEE: setVariationalRefinementGamma- Returns:
- automatically generated
-
getFinestScale
public int 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
-
getGradientDescentIterations
public int 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
-
getPatchSize
public int 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
-
getPatchStride
public int getPatchStride()
Stride between neighbor patches. Must be less than patch size. Lower values correspond to higher flow quality. SEE: setPatchStride- Returns:
- automatically generated
-
getVariationalRefinementIterations
public int 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
-
setFinestScale
public void setFinestScale(int val)
getFinestScale SEE: getFinestScale- Parameters:
val
- automatically generated
-
setGradientDescentIterations
public void setGradientDescentIterations(int val)
getGradientDescentIterations SEE: getGradientDescentIterations- Parameters:
val
- automatically generated
-
setPatchSize
public void setPatchSize(int val)
getPatchSize SEE: getPatchSize- Parameters:
val
- automatically generated
-
setPatchStride
public void setPatchStride(int val)
getPatchStride SEE: getPatchStride- Parameters:
val
- automatically generated
-
setUseMeanNormalization
public void setUseMeanNormalization(boolean val)
getUseMeanNormalization SEE: getUseMeanNormalization- Parameters:
val
- automatically generated
-
setUseSpatialPropagation
public void setUseSpatialPropagation(boolean val)
getUseSpatialPropagation SEE: getUseSpatialPropagation- Parameters:
val
- automatically generated
-
setVariationalRefinementAlpha
public void setVariationalRefinementAlpha(float val)
getVariationalRefinementAlpha SEE: getVariationalRefinementAlpha- Parameters:
val
- automatically generated
-
setVariationalRefinementDelta
public void setVariationalRefinementDelta(float val)
getVariationalRefinementDelta SEE: getVariationalRefinementDelta- Parameters:
val
- automatically generated
-
setVariationalRefinementGamma
public void setVariationalRefinementGamma(float val)
getVariationalRefinementGamma SEE: getVariationalRefinementGamma- Parameters:
val
- automatically generated
-
setVariationalRefinementIterations
public void setVariationalRefinementIterations(int val)
getGradientDescentIterations SEE: getGradientDescentIterations- Parameters:
val
- automatically generated
-
finalize
protected void finalize() throws java.lang.Throwable
- Overrides:
finalize
in classDenseOpticalFlow
- Throws:
java.lang.Throwable
-
-