3

I'm aiming to search through a library of images using an image as the query. I want to use SURF and a customized NN technique to match relevant images and display the top ten results from that image.

Once I get the SURF NN matching code working for comparing two images, how should I go about modifying that code to search through the library of images and spit out the top ten nearest image matches?

Thanks

hndrk
  • 31
  • 3

2 Answers2

0

you can compute all SURF features of images, then build kd-tree. for knn search you can also use flann based search implemented in opencv. (it can be tunable for search time\precision so it can be fast approximate search)

mrgloom
  • 20,061
  • 36
  • 171
  • 301
0

Once I get the SURF NN matching code working for comparing two images, how should I go about modifying that code to search through the library of images and spit out the top ten nearest image matches?

Does this help: https://code.ros.org/trac/opencv/browser/trunk/opencv/samples/cpp/matching_to_many_images.cpp ?

Unapiedra
  • 15,037
  • 12
  • 64
  • 93
  • thanks for your reply but is there a simpler method? I'm not looking for the most elegant solution, I can't really follow that sample... Also, would you know where to find a basic example of using surf to match images (I've already been looking at find_obj.cpp), thank you – hndrk Oct 20 '11 at 14:43
  • http://www.aishack.in/topics/tutorials/vision/ they explain quite well how sift works, and I think he does exactly what you want. Do you mind searching through there? – Unapiedra Oct 20 '11 at 16:39
  • I just had a look through "Learning OpenCV", OReilly, Bradski & Kaehler as well as through "OpenCV Cookbook", Packt, R. Laganiere. Neither have what you want directly. – Unapiedra Oct 20 '11 at 17:12
  • I had a look through that website you linked me to I think I know conceptually what I want done, but looking at his code I still can't follow that. I've looked through those two books you mentioned too. -- I want to define my own feature vector which considers the laplacian, size, direction, hessian perhaps using a radius of influence rather than just a point. I have been trying to simplify find_obj.cpp... Would you be able to provide some further guidance? Thanks very much – hndrk Oct 20 '11 at 17:38
  • That code reads ALL the images and SURF descriptors into memory. That's about the most unscalable way to search an image database... – Cerin Dec 10 '11 at 21:28
  • @Cerin, could you please provide an answer that is more scalable? – Unapiedra Dec 11 '11 at 11:58
  • @Unapiedra, This is still an active research topic, but the way I've done it in the past is to store the descriptors in a database, incrementally feed them to a k-means clustering algorithm, generate a cluster histogram for each image, train a classifier on the histograms, and then search by classifying an incoming histogram. There's overhead with updating the histograms when the clusters are updated, but otherwise it works out-of-core. – Cerin Dec 11 '11 at 18:55