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

确认两个:

1、图像是灰度的

// Read in the image

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

cvtColor(img, img, CV_BGR2GRAY);

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

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

cv::Mat uDictionary;

dictionary.convertTo(uDictionary, CV_8UC1);

bowDE.setVocabulary(uDictionary);

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

转载于:https://www.cnblogs.com/rjjhyj/p/10784929.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值