krammer
krammer

Reputation: 2668

How to use SIFT descriptors with Locality Sensitive Hashing?

LSH is used with binary strings and is very efficient in indexing and retrieval. While SIFT is not a binary descriptor, it is still the best descriptor available there. Is it possible to use SIFT with LSH ? Also, are there better indexing techniques available for SIFT features ?

I have tried using SIFT with FLANNBased Matcher with LSH in OpenCV, but get the following error:

what(): C:\OpenCV\opencv\modules\flann\src\miniflann.cpp:315: error: (-210) type=5 in function buildIndex_

Code:

cv::Ptr<cv::FlannBasedMatcher> matcher = new cv::FlannBasedMatcher(new cv::flann::LshIndexParams(5, 24, 2));
        matcher->match( descriptors, descriptors1, matches );

Note: This question was more apt at dsp.stackexchange.com, but it is in read only mode right now.

Upvotes: 4

Views: 3159

Answers (2)

old-ufo
old-ufo

Reputation: 2860

The two best indexing techniques used for SIFT are kd-tree and k-means, try them. Both of them are implemented in FLANN matcher which is part of OpenCV. This two papers compares FLANN and LSH for SIFTs:

"Locality sensitive hashing: a comparison of hash function types and querying mechanisms"

"How to Use SIFT Vectors to Analyze an Image with Database Templates"

Actually, Alexandr Andoni have implemented something very similar to what you want.

Upvotes: 3

sansuiso
sansuiso

Reputation: 9379

LSH is an algorithm of dimensionality reduction that outputs binary strings. It was designed to index real-valued, high-dimensional data (but with an intrinsic lower dimensionality, such as manifolds) with binary codes.

You can try to implement LSH by yourself so that it can work with SIFT descriptors. The naive and easiest way of doing it would be to use random projections, but some more clever scheme using the fact that a SIFT descriptor is an aggregate of gradient orientation histograms can probably be exploited to produce a more efficient hash function.

Upvotes: 3

Related Questions