How to do it...

You need to complete the following steps:

  1. Import the necessary modules and load images:
import cv2import numpy as npimg0 = cv2.imread('../data/Lena.png', cv2.IMREAD_COLOR)img1 = cv2.imread('../data/Lena_rotated.png', cv2.IMREAD_COLOR)img1 = cv2.resize(img1, None, fx=0.75, fy=0.75)img1 = np.pad(img1, ((64,)*2, (64,)*2, (0,)*2), 'constant', constant_values=0)imgs_list = [img0, img1]
  1. Create a SIFT keypoints detector:
detector = cv2.xfeatures2d.SIFT_create(50)
  1. Detect the keypoints in each image, visualize the keypoints and display the result:
for i in range(len(imgs_list)):    keypoints, descriptors = detector.detectAndCompute(imgs_list[i], None)         imgs_list[i] = cv2.drawKeypoints(imgs_list[i], keypoints, None, (0, 255, 0), ...

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.