How it works...

In this sample, we used the OpenCV function cv2.goodFeaturesToTrack. This function detects keypoints and implements a list of heurisitics intended to improve the overall quality of keypoints for such computer vision tasks as object tracking through selecting a subset of good keypoints. This function ensures that the keypoints are not located too close to each other, the minimal distance is regulated with the minDistance parameter. The qualityLevel parameter regulates which keypoints are considered weak with respect to the strongest keypoint, and are removed from the originally detected ones. The function also has the parameter maxCorners, which is the maximal number of detected keypoints.

The following output is expected: ...

Get OpenCV 3 Computer Vision with Python Cookbook 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.