Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In bag of visual words, how to pass descriptors instead of keypoints?

I'm implementing the Bag of Features model through OpenCV.

My workflow is the following:

  1. Compute SIFT keypoints & descriptors for each image in the dataset
  2. Using the descriptors and cv::BOWKMeansTrainer, compute the k centroids using k-means algorithm via cv::BOWKMeansTrainer.cluster()
  3. Using cv::BOWImgDescriptorExtractor compute the word of each image img from the dataset (same for a query) through compute(img,keyPoints,word) (we can use keyPoints that we computed during step 1.).

The problem is in point 3: I think that compute compute again the descriptors of img. This is terribly inefficient, we already computed the needed descriptors in step 1.!

How can I call compute passing the already computed descriptors?

Notice that I didn't check the implementation of compute, but I'm quite sure (from my understanding of the BoF model) that interally is going to compute the descriptors.