Detecting SIFT feature points
Scale Invariant Feature Transform (SIFT) is one of the most popular features in the field of Computer Vision. David Lowe first proposed this in his seminal paper, which is available at https://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf. It has since become one of the most effective features to use for image recognition and content analysis. It is robust against scale, orientation, intensity, and so on. This forms the basis of our object recognition system. Let's take a look at how to detect these feature points.
How to do it…
Create a new Python file, and import the following packages:
import sys import cv2 import numpy as np
Load the input image. We will use
table.jpg
:# Load input image -- 'table.jpg' input_file = sys.argv[1] img = cv2.imread(input_file)
Convert this image to grayscale:
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
Initialize the SIFT detector object and extract the keypoints:
sift = cv2.xfeatures2d.SIFT_create() keypoints = sift.detect(img_gray,...