Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To solve all the problems just combine the answers of Mathieu Barnachon and igsgk:

//first convert uchar to float
cv::Mat descriptors;
extractorIn->compute(img, keypoints, descriptors);
cv::Mat descriptorsFloat;
descriptors.convertTo(descriptorsFloat, CV_32FC1);

// ... and then set the vocabulary as uchar after clustering
cv::Mat dictionary = bowTrainer.cluster();
cv::Mat uDictionary;
dictionary.convertTo(uDictionary, CV_8UC1);

This solved it for my case