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 intPRESET_FASTstatic intPRESET_MEDIUMstatic intPRESET_ULTRAFAST
-
Constructor Summary
Constructors Modifier Constructor Description protectedDISOpticalFlow(long addr)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DISOpticalFlow__fromPtr__(long addr)static DISOpticalFlowcreate()Creates an instance of DISOpticalFlowstatic DISOpticalFlowcreate(int preset)Creates an instance of DISOpticalFlowprotected voidfinalize()intgetFinestScale()Finest level of the Gaussian pyramid on which the flow is computed (zero level corresponds to the original image resolution).intgetGradientDescentIterations()Maximum number of gradient descent iterations in the patch inverse search stage.intgetPatchSize()Size of an image patch for matching (in pixels).intgetPatchStride()Stride between neighbor patches.booleangetUseMeanNormalization()Whether to use mean-normalization of patches when computing patch distance.booleangetUseSpatialPropagation()Whether to use spatial propagation of good optical flow vectors.floatgetVariationalRefinementAlpha()Weight of the smoothness term SEE: setVariationalRefinementAlphafloatgetVariationalRefinementDelta()Weight of the color constancy term SEE: setVariationalRefinementDeltafloatgetVariationalRefinementEpsilon()Norm value shift for robust penalizer SEE: setVariationalRefinementEpsilonfloatgetVariationalRefinementGamma()Weight of the gradient constancy term SEE: setVariationalRefinementGammaintgetVariationalRefinementIterations()Number of fixed point iterations of variational refinement per scale.voidsetFinestScale(int val)getFinestScale SEE: getFinestScalevoidsetGradientDescentIterations(int val)getGradientDescentIterations SEE: getGradientDescentIterationsvoidsetPatchSize(int val)getPatchSize SEE: getPatchSizevoidsetPatchStride(int val)getPatchStride SEE: getPatchStridevoidsetUseMeanNormalization(boolean val)getUseMeanNormalization SEE: getUseMeanNormalizationvoidsetUseSpatialPropagation(boolean val)getUseSpatialPropagation SEE: getUseSpatialPropagationvoidsetVariationalRefinementAlpha(float val)getVariationalRefinementAlpha SEE: getVariationalRefinementAlphavoidsetVariationalRefinementDelta(float val)getVariationalRefinementDelta SEE: getVariationalRefinementDeltavoidsetVariationalRefinementEpsilon(float val)getVariationalRefinementEpsilon SEE: getVariationalRefinementEpsilonvoidsetVariationalRefinementGamma(float val)getVariationalRefinementGamma SEE: getVariationalRefinementGammavoidsetVariationalRefinementIterations(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)
-
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
-
setFinestScale
public void setFinestScale(int val)
getFinestScale SEE: getFinestScale- Parameters:
val- 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
-
setPatchSize
public void setPatchSize(int val)
getPatchSize SEE: getPatchSize- Parameters:
val- 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
-
setPatchStride
public void setPatchStride(int val)
getPatchStride SEE: getPatchStride- Parameters:
val- 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
-
setGradientDescentIterations
public void setGradientDescentIterations(int val)
getGradientDescentIterations SEE: getGradientDescentIterations- Parameters:
val- 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
-
setVariationalRefinementIterations
public void setVariationalRefinementIterations(int val)
getGradientDescentIterations SEE: getGradientDescentIterations- Parameters:
val- automatically generated
-
getVariationalRefinementAlpha
public float getVariationalRefinementAlpha()
Weight of the smoothness term SEE: setVariationalRefinementAlpha- Returns:
- automatically generated
-
setVariationalRefinementAlpha
public void setVariationalRefinementAlpha(float val)
getVariationalRefinementAlpha SEE: getVariationalRefinementAlpha- Parameters:
val- automatically generated
-
getVariationalRefinementDelta
public float getVariationalRefinementDelta()
Weight of the color constancy term SEE: setVariationalRefinementDelta- Returns:
- automatically generated
-
setVariationalRefinementDelta
public void setVariationalRefinementDelta(float val)
getVariationalRefinementDelta SEE: getVariationalRefinementDelta- Parameters:
val- automatically generated
-
getVariationalRefinementGamma
public float getVariationalRefinementGamma()
Weight of the gradient constancy term SEE: setVariationalRefinementGamma- Returns:
- automatically generated
-
setVariationalRefinementGamma
public void setVariationalRefinementGamma(float val)
getVariationalRefinementGamma SEE: getVariationalRefinementGamma- Parameters:
val- automatically generated
-
getVariationalRefinementEpsilon
public float getVariationalRefinementEpsilon()
Norm value shift for robust penalizer SEE: setVariationalRefinementEpsilon- Returns:
- automatically generated
-
setVariationalRefinementEpsilon
public void setVariationalRefinementEpsilon(float val)
getVariationalRefinementEpsilon SEE: getVariationalRefinementEpsilon- Parameters:
val- 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
-
setUseMeanNormalization
public void setUseMeanNormalization(boolean val)
getUseMeanNormalization SEE: getUseMeanNormalization- Parameters:
val- 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
-
setUseSpatialPropagation
public void setUseSpatialPropagation(boolean val)
getUseSpatialPropagation SEE: getUseSpatialPropagation- Parameters:
val- automatically generated
-
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
-
finalize
protected void finalize() throws java.lang.Throwable- Overrides:
finalizein classDenseOpticalFlow- Throws:
java.lang.Throwable
-
-