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

    - ### Fields inherited from class org.opencv.core.Algorithm

      `nativeObj`

  - ### 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 DISOpticalFlow
    `static DISOpticalFlow` | `create​(int preset)` | Creates an instance of DISOpticalFlow
    `protected 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: setVariationalRefinementAlpha
    `float` | `getVariationalRefinementDelta()` | Weight of the color constancy term SEE: setVariationalRefinementDelta
    `float` | `getVariationalRefinementEpsilon()` | Norm value shift for robust penalizer SEE: setVariationalRefinementEpsilon
    `float` | `getVariationalRefinementGamma()` | Weight of the gradient constancy term SEE: setVariationalRefinementGamma
    `int` | `getVariationalRefinementIterations()` | Number of fixed point iterations of variational refinement per scale.
    `void` | `setFinestScale​(int val)` | getFinestScale SEE: getFinestScale
    `void` | `setGradientDescentIterations​(int val)` | getGradientDescentIterations SEE: getGradientDescentIterations
    `void` | `setPatchSize​(int val)` | getPatchSize SEE: getPatchSize
    `void` | `setPatchStride​(int val)` | getPatchStride SEE: getPatchStride
    `void` | `setUseMeanNormalization​(boolean val)` | getUseMeanNormalization SEE: getUseMeanNormalization
    `void` | `setUseSpatialPropagation​(boolean val)` | getUseSpatialPropagation SEE: getUseSpatialPropagation
    `void` | `setVariationalRefinementAlpha​(float val)` | getVariationalRefinementAlpha SEE: getVariationalRefinementAlpha
    `void` | `setVariationalRefinementDelta​(float val)` | getVariationalRefinementDelta SEE: getVariationalRefinementDelta
    `void` | `setVariationalRefinementEpsilon​(float val)` | getVariationalRefinementEpsilon SEE: getVariationalRefinementEpsilon
    `void` | `setVariationalRefinementGamma​(float val)` | getVariationalRefinementGamma SEE: getVariationalRefinementGamma
    `void` | `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`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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

  - ### Constructor Detail

    - #### DISOpticalFlow

          protected DISOpticalFlow​(long addr)

  - ### 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:
        `finalize` in class `DenseOpticalFlow`
      Throws:
        `java.lang.Throwable`