_queryDescriptors.type() == trainDescType [closed]
Error message:
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.1.2-dev) /home/ztftrue/Downloads/opencv/modules/features2d/src/matchers.cpp:756: error: (-215:Assertion failed) _queryDescriptors.type() == trainDescType in function 'knnMatchImpl'
Code:
Mat input = cv::imread("input.jpg",IMREAD_COLOR);
cout << "input type: "<<input.type() << endl;
cout << "descriptors type: " << descriptors.type() << endl;
bowide.compute(input, keypoints, descriptors);
Out put:
input type: 21 descriptors type: 0
I try:
input.convertTo(input, CV_32F, 1 / 255.0);
or
input.convertTo(input, CV_32F);
and filter keypoint vector
if (!keypoints.empty() && keypoints.size() > 10) {
cv::Mat descriptors;
extractor->compute(it, keypoints, descriptors);
if (!descriptors.empty()) {
descriptors.convertTo(descriptors, CV_32F);
trainingDescriptors.push_back(descriptors);
} else {
std::cout << "- No descriptors found." << std::endl;
}
} else {
std::cout << "- No keypoints found." << std::endl;
}
what is "extractor" ?