when using BOWImgDescriptorExtractor with DescriptorExtractor as SIFT and DescriptorMatcher as ButeForce i am getting error as
OpenCV Error: Assertion failed (queryDescriptors.type() == trainDescCollection[0].type()) in knnMatchImpl,
what could me my error.
when i am trying to compute eg.
bowide->compute(img, keypoints, response_hist);
I had the same error using the Surf feature detector and extractor with BFMatcher.
The error occurs because the query descriptor mat and train descriptor mat doesn't have the same type - as stated in your error message. This happened to me only when no keypoints for the train or query image could be calculated by the feature detector. Check that the size of your keypoints vector is not zero before doing the matching.
I also had the same error. There is another possible reason: the dtype
of the dictionary should be float32
. It turns out that I did some operations with the dictionary with numpy before calling the setVocabulary
function, which changed the dtype
of the dictionary implicitly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With