Match image with database using SIFT

I'm currently working on a python programm that matches an input image with the closest image in a database. Im using python opencv with SIFT descriptors to do so. I have a working prototype with the following steps:

  1. Extract SIFT descriptors of the input image

For each image:

  1. compare with input and find matching keypoints between the two using flann.knnMatch

  2. using Lowe's ratio test identify good keypoint matches

  3. compute a score for each image by calculating the average distance per good keypoint match

The image with the lowest score would then be the best match. My aproach seems very slow, especially with larger databases.

Is there a faster way to match an image with a database if this is even the correct way?

1 answer

  • answered 2021-05-15 16:55 Patates

    There are better approaches than SIFT for searching images. Since i do not know the images in your database, I am just going to say you what would i do instead of SIFT approach.

    LBP (Local binary patterns) or GLCM (Gray Level Co-occurrence Matrix) can speed up your solution. Calculate stastics (GLCM or LBPs ) for each image in the database and store them with indexing.Lets call them image signs from now on. On search, calculate the CCC (cross correlation coefficent) between image of interest sign and database image sign. Sort them by CCC at descending order. I am just assuming the images you are going match has relatively small baseline and camera angle difference. SIFT like approaches do not work well with highly rotated images.

    There are lots of papers about your problem. Some of them uses optical flow to find images. You should find the best one for your situation.