Package org.opencv.video

## Class SparseOpticalFlow

- java.lang.Object
- - org.opencv.core.Algorithm
  - - org.opencv.video.SparseOpticalFlow

- Direct Known Subclasses:
    `SparsePyrLKOpticalFlow`

      public class SparseOpticalFlow
      extends Algorithm

  Base interface for sparse optical flow algorithms.

- - ### Field Summary

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

      `nativeObj`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `SparseOpticalFlow​(long addr)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static SparseOpticalFlow` | `__fromPtr__​(long addr)` |
    `void` | `calc​(Mat prevImg, Mat nextImg, Mat prevPts, Mat nextPts, Mat status)` | Calculates a sparse optical flow.
    `void` | `calc​(Mat prevImg, Mat nextImg, Mat prevPts, Mat nextPts, Mat status, Mat err)` | Calculates a sparse optical flow.
    `protected void` | `finalize()` |

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

- - ### Constructor Detail

    - #### SparseOpticalFlow

          protected SparseOpticalFlow​(long addr)

  - ### Method Detail

    - #### __fromPtr__

          public static SparseOpticalFlow __fromPtr__​(long addr)

    - #### calc

          public void calc​(Mat prevImg,
                           Mat nextImg,
                           Mat prevPts,
                           Mat nextPts,
                           Mat status,
                           Mat err)

      Calculates a sparse optical flow.
      Parameters:
        `prevImg` - First input image.
        `nextImg` - Second input image of the same size and the same type as prevImg.
        `prevPts` - Vector of 2D points for which the flow needs to be found.
        `nextPts` - Output vector of 2D points containing the calculated new positions of input features in the second image.
        `status` - Output status vector. Each element of the vector is set to 1 if the flow for the corresponding features has been found. Otherwise, it is set to 0.
        `err` - Optional output vector that contains error response for each point (inverse confidence).

    - #### calc

          public void calc​(Mat prevImg,
                           Mat nextImg,
                           Mat prevPts,
                           Mat nextPts,
                           Mat status)

      Calculates a sparse optical flow.
      Parameters:
        `prevImg` - First input image.
        `nextImg` - Second input image of the same size and the same type as prevImg.
        `prevPts` - Vector of 2D points for which the flow needs to be found.
        `nextPts` - Output vector of 2D points containing the calculated new positions of input features in the second image.
        `status` - Output status vector. Each element of the vector is set to 1 if the flow for the corresponding features has been found. Otherwise, it is set to 0.

    - #### finalize

          protected void finalize()
                           throws java.lang.Throwable

      Overrides:
        `finalize` in class `Algorithm`
      Throws:
        `java.lang.Throwable`