OpenCV Error: Assertion failed (queryDescriptors.type() == trainDescCollection[0].type()) in knnMatc

确认两个:spa

一、图像是灰度的code

// Read in the imageip

Mat img = imread(entryPath.string(), 1);string

cvtColor(img, img, CV_BGR2GRAY);it

二、描述子要是CV_8UC1形式的(在以前用描述子造成词袋时,描述子格式有转换为CV_32F过)。io

cv::Mat dictionary = bowTrainer.cluster();opencv

cv::Mat uDictionary;class

dictionary.convertTo(uDictionary, CV_8UC1);im

bowDE.setVocabulary(uDictionary);word

仍然有疑惑详见:https://answers.opencv.org/question/17460/how-to-use-bag-of-words-example-with-brief-descriptors/

相关文章
相关标签/搜索