How can i get LSH from ORB descriptors?
I will very thank for your comments and answers I am newbie in Opencv
Please, tell me, how can i get list of hashes from matcher?
My code and interesting rows:
//matcher_->getListOfLsh();
//Get list of hashes "qgdlfospahs....
int main(int argc, char** argv)
{
cv::Mat img1 = cv::imread("categories2.jpg", CV_LOAD_IMAGE_GRAYSCALE);//CV_LOAD_IMAGE_GRAYSCALE
cv::Ptr<cv::FeatureDetector> detector = ORB::create();
cv::Ptr<cv::DescriptorExtractor> descriptor = ORB::create();
std::vector<cv::KeyPoint> keypoints1;
detector->detect(img1, keypoints1);
std::cout«"find "«keypoints1.size()«" keypoints in img1"«std::endl;
cv::Mat descriptors1;
descriptor->compute(img1, keypoints1, descriptors1);
cv::Ptr<cv::DescriptorMatcher> matcher_;
matcher_ = new cv::FlannBasedMatcher(new cv::flann::LshIndexParams(5, 24, 2));
matcher_->add(descriptors1); // i think that here matcher generate hash indexes
//matcher_->getListOfLsh(); i need something like this
//Get list of hashes "qgdlfospahsy24sa6nhss65s7hns7" for ORB descriptors?
cv::waitKey(0);
return 0;
}
are you really interested in matching here ? the FlannBasedMatcher does not offer such functionality (and might be the wrong tool anyway.)
i'd try with a flann::Index instead.. maybe you can retrieve the hashes from LshIndexParams after training
@berak Thank you! I am newbie in opencv, can you show me a part of code, which can help me to get hashes from LshIndexParams?
sorry, i was probably wrong. does not seem possible at all. (Index::getAll() only retrieves the params, not the hashtable).
what do you want to do with it ? can't you do your own hashing ?
@berak i want to save hashes in mysql table. Then i want set index for hashes and use SELECT for search the same descriptors. I can write my own hashes but it will be more difficult, then use almost ready solution. Thank you for help!
i guess, you 'll have to write your own lsh then, trying to abuse opencv for this does not seem feasible.
@berak Thank you very much!
you could take a look here: https://github.com/Itseez/opencv/blob...