Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Bug in BOWKMeansTrainer or how to handle this?

I have used a BOWKMeansTrainer on FREAK descriptors and I got an error because of kmeans, so I have transformed the descriptors in CV_32F. When I tried a BOWImgDescriptorExtractor to match the descriptors of features in an image with the trained ones and it seems that I get another error:

 opencv/modules/features2d/src/matchers.cpp:351: error: (-215) queryDescriptors.type() == trainDescCollection[0].type() in function knnMatchImpl

I am sure that I use the same descriptors (FREAK) and the same matcher (BruteForce). The problem seems to be because of that transformation to float...

The idea is that I have 2 process: the train and the detection. In the train I use the BOWKMeansTrainer, that needs CV_32F descriptors, so I convert the descriptors into float, and then saved the clustered descriptors (aka vocabulary). The idea is that the vocabulary contains float descriptors. Is this a bug? Shouldn't this problem be handled in the cluster method?

Another question that I have is: Supposing that I have that vocabulary file and I read it, how do I know what type should it be? I know that FileStorage is saving the type, but because of the cluster that is returning a CV32F Mat, the type of the data in the file is float... Is there a doc where is mentioned what type of descriptors does each extractor returns?