Is local sensitive hashing algorithm only compatible with binary descriptors?

asked 2013-03-07 01:08:15 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

Hi,

I am trying to use local sensitive hashing algorithm in flann in opencv 2.4.4. Here is my code.

Ptr<IplImage> cluster_image = cvLoadImage("C:\\Users\\Administrator\\Pictures\\1.jpg");

vector<KeyPoint> cluster_keypoint;
Mat des;

description_detect(cluster_image,cluster_keypoint,des,SIFT_DESCRIPTION);//My function to extract the sift feature from image.//Descriptions are stored at variable des.

flann::Index my_index(des, flann::LshIndexParams(10, 10, 2));

When running this code to build the index of flann by lsh algo. The code assert that

"Opencv Error,unsupported format or combination of formats type=5"

I check code in miniflann.cpp. It seems that local sensitive hashing algorithm in flann are only compatible with CV_8U Mat type,other than CV_32F which is generated by sift.

However, other binary descriptors detected from ORB, Brief, BRISK, FREAK can produce CV_8U Mat type.

So my question is: Is local sensitive hashing algorithm only compatible with binary descriptors in opencv?

edit retag flag offensive close merge delete

Comments

1

ran into the similar problem trying to feed descriptors into ml algos, which want float features as well.

you can des.convertTo(des_float, CV_32F); // there's also scaling and offset params

but it seems, those binary descriptor are optimised for something like hamming distance, while the flann::Index might be using some totally different distance scheme here.

so converting might work, but might be not optimal.

berak gravatar imageberak ( 2013-03-07 16:10:22 -0600 )edit