OpenCV Error: Assertion failed (data0.dims <= 2 && type == 5 && K > 0) in cv::kmeans
报错:
数据类型不对,转换一下就可以了。 all_descriptors .convertTo(all_descriptors, CV_32F);
加入在 Mat vocabulary = bowTrainer.cluster(allDescriptors); 之前就可以了
allDescriptors.convertTo(allDescriptors, CV_32F);
BOWKMeansTrainer bowTrainer(wordCount, tc, retries, flags);
Mat vocabulary = bowTrainer.cluster(allDescriptors);