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);
bowTrainerInOut.add(descriptorsFloat);
// ... and then set the vocabulary as uchar after clustering
cv::Mat dictionary = bowTrainer.cluster();
cv::Mat uDictionary;
dictionary.convertTo(uDictionary, CV_8UC1);
bowDE.setVocabulary(uDictionary);
This solved it for my case