pysteps.motion.lucaskanade.track_features

pysteps.motion.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 features tracking algorithm (cv.calcOpticalFlowPyrLK).

Parameters:
prvs_image : array_like or MaskedArray

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

next_image : array_like or MaskedArray

Array of shape (m, n) containing the successive image. Invalid values (Nans or infs) are filled using 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.

nr_levels : int, optional

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

criteria : tuple of int, optional

The TermCriteria parameter in calcOpticalFlowPyrLK , which specifies the termination criteria of the iterative search algorithm.

flags : int, optional

Operation flags, see documentation calcOpticalFlowPyrLK.

min_eig_thr : float, optional

The minEigThreshold parameter in calcOpticalFlowPyrLK.

verbose : bool, optional

Print the number of vectors that have been found.

Returns:
xy : array_like

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

uv : array_like

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, https://doi.org/10.1109/HPDC.2004.1323531, 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.