在knnMatchImpl中断言失败(queryDescriptors.type()== trainDescCollection [0] .type()),

use*_*804 6 c++ opencv image machine-learning image-processing

当使用带有DescriptorExtractor的BOWImgDescriptorExtractor作为SIFTDescriptorMatcher作为ButeForce时,我收到错误

OpenCV错误:在knnMatchImpl中断言失败(queryDescriptors.type()== trainDescCollection [0] .type()),

我的错误是什么?

当我试图计算例如.

bowide-> compute(img,keypoints,response_hist);

Fri*_*rik 11

我使用Surf功能检测器和BFMatcher提取器时出现了同样的错误.

发生此错误的原因是查询描述符mat和train描述符mat不具有相同的类型 - 如错误消息中所述.只有当特征检测器无法计算出火车或查询图像的关键点时,才会发生这种情况.在进行匹配之前,请检查关键点向量的大小是否为零.