Using point matching with optic flow

An alternative to using rich features is using optic flow. Optic flow is the process of estimating motion between two consecutive image frames by calculating a displacement vector. A displacement vector can be calculated for every pixel in the image (dense) or only for selected points (sparse).

One of the most commonly used techniques for calculating dense optic flow is the Lukas-Kanade method. It can be implemented in OpenCV with a single line of code, by using the cv2.calcOpticalFlowPyrLK function.

But before that, we need to select some points in the image that are worth tracking. Again, this is a question of feature selection. If we are interested in getting an exact result for only a few highly salient ...

Get OpenCV 4 with Python Blueprints - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.