Ask Your Question

How to use BRIEF, ORB, FREAK or integer descriptor with cv::BOW?

asked 2013-12-26 18:25:13 -0500

fbnsantos gravatar image

What is the easiest way to use BRIEF, ORB, FREAK or integer based descriptor with opencv BOW implementation.

At this moment (based on during the the dictionary build I do:

   orbDesc.compute(bwimage, keypoints_1, descriptors1);
   cv::Mat descr;
   descriptors1.convertTo(descr, CV_32F);

And I get the dictionary ( cv::BOWKMeansTrainer, withflags=cv::KMEANS_PP_CENTERS;), however when want o get the word histogram, I do this:

mymatcher=new cv::FlannBasedMatcher; 
myextractor=new cv::OrbDescriptorExtractor;
mydetector=new cv::OrbFeatureDetector;
myBOW=new cv::BOWImgDescriptorExtractor(myextractor,mymatcher);
std::vector<cv::KeyPoint> keypoints;
cv::Mat bowDescriptor;

However, the program breaks at myBOW->compute. This is because orb uses a non float vector. What is the easiest way for I solve this?

from the another post question there is this solution (convert the dictionary to unsigned char ):

cv::Mat floatdictonary; // 
floatDictionary = bowTrainer.cluster(floatFeaturesUnclustered);//you have convert features //unsigned char to float 
cv::Mat udictionary; 
floatdictionary.convertTo(udictonary,CV_8UC1); // 
 Mat bowDescriptor; std::vector<std::vector<int> > pointIdxOfClusters; 
 bowDE.compute(img, keypoints, bowDescriptor,&pointIdxOfClusters);

This last option is a good option?

thanks, Filipe

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2014-07-16 13:13:43 -0500

warith_h gravatar image

As said in the similar post, this is NOT the right solution, the medoid/mean is not correct giving poor results in my experiments for image retrieval. I am looking for a more correct solution.

edit flag offensive delete link more


Yes, you are definitively right, I also say this in my post, please also have a look at the link of my post above.

Guanta gravatar imageGuanta ( 2014-07-17 02:20:08 -0500 )edit

@Guanta: Thank you. Indeed, we have to look at what Marius Muja did in his implementation of FLANN.

warith_h gravatar imagewarith_h ( 2014-07-17 04:08:14 -0500 )edit

answered 2013-12-27 09:47:04 -0500

Guanta gravatar image

updated 2013-12-27 10:11:01 -0500

The easiest way is to convert the binary orb-descriptor to float. The last option, converting the vocabulary to uchar should also work. However note, that both ways contradict in some way the intention of binary descriptors since the implemented BOWImageDescriptor doesn't use the hamming-distance for the comparison (and the internal clustering) of two binary descriptors. Maybe my answer to a similar post: can help you further.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-12-26 18:25:13 -0500

Seen: 2,697 times

Last updated: Jul 16 '14