How to do it...

You need to complete the following steps:

  1. Import the necessary modules:
import cv2import matplotlib.pyplot as plt
  1. Load the test image:
img = cv2.imread('../data/Lena.png', cv2.IMREAD_GRAYSCALE)
  1. Find good keypoints:
corners = cv2.goodFeaturesToTrack(img, 100, 0.05, 10)
  1. Visualize the results:
for c in corners:    x, y = c[0]    cv2.circle(img, (x, y), 5, 255, -1)plt.figure(figsize=(10, 10))plt.imshow(img, cmap='gray')plt.tight_layout()plt.show()

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.