Image similarity with keypoints in Python

Standard

Other than template matching, there are other algorithms to find objects in images.  A group of algorithms based on keypoints is an example of that. Every keypoint must be a unique point in terms of contrast, edges etc.  Once these keypoints  are extracted the program can match them with keypoints of other images.

Let us start by extracting keypoints from an input image.  To do this, we use the cv2.FeatureDetector_create() method. As input it takes the name of a keypoint detection algorithm. There is a large variety of this:  MSER, SURF, ORB and many more.

Output:

The next step, is to take the keypoints from another image and match them. We can not simply match 2d vectors (x,y). Every keypoint  will be described using a descriptor or patch.  Finally, we need a matcher object to match all these patches.

The program will output the number of matching keypoints. This is the similarity between image1 and image2. The similarity will rise with the number of matching keypoints found.

Output:

Uncategorized

Leave a Reply