pysteps.tracking.lucaskanade.track_features

pysteps.tracking.lucaskanade.track_features

pysteps.tracking.lucaskanade.track_features(prvs_image, next_image, points, winsize=(50, 50), nr_levels=3, criteria=(3, 10, 0), flags=0, min_eig_thr=0.0001, verbose=False)

Interface to the OpenCV Lucas-Kanade feature tracking algorithm (cv.calcOpticalFlowPyrLK).

Parameters
prvs_image: ndarray_ or MaskedArray_

Array of shape (m, n) containing the first image. Invalid values (Nans or infs) are replaced with the min value.

next_image: ndarray_ or MaskedArray_

Array of shape (m, n) containing the successive image. Invalid values (Nans or infs) are replaced with the min value.

points: array_like

Array of shape (p, 2) indicating the pixel coordinates of the tracking points (corners).

winsize: tuple of int, optional

The winSize parameter in calcOpticalFlowPyrLK. It represents the size of the search window that it is used at each pyramid level. The default is (50, 50).

nr_levels: int, optional

The maxLevel parameter in calcOpticalFlowPyrLK. It represents the 0-based maximal pyramid level number. The default is 3.

criteria: tuple of int, optional

The TermCriteria parameter in calcOpticalFlowPyrLK , which specifies the termination criteria of the iterative search algorithm. The default is (3, 10, 0).

flags: int, optional

Operation flags, see documentation calcOpticalFlowPyrLK. The default is 0.

min_eig_thr: float, optional

The minEigThreshold parameter in calcOpticalFlowPyrLK. The default is 1e-4.

verbose: bool, optional

Print the number of vectors that have been found. The default is False.

Returns
xy: ndarray

Array of shape (d, 2) with the x- and y-coordinates of d <= p detected sparse motion vectors.

uv: ndarray

Array of shape (d, 2) with the u- and v-components of d <= p detected sparse motion vectors.

Notes

The tracking points can be obtained with the pysteps.utils.images.ShiTomasi_detection() routine.

References

Bouguet, J.-Y.: Pyramidal implementation of the affine Lucas Kanade feature tracker description of the algorithm, Intel Corp., 5, 4, 2001

Lucas, B. D. and Kanade, T.: An iterative image registration technique with an application to stereo vision, in: Proceedings of the 1981 DARPA Imaging Understanding Workshop, pp. 121–130, 1981.