BFmatcher types error

asked 2013-08-06 07:15:40 -0600

ximobayo gravatar image

Hi everyone.

I have some trouble with the BFmatcher. I make a matrix with some descriptors but when I try knnmatch() Doesn't work due a types error. I have a set of descriptor in mainDesc I pick some of them

Mat kdesc();
kdesc.push_back(mainDesc.row(i));

The matcher is a member of a function. Does need some inizialization? Then I call knnMatch and the ouput is:

OpenCV Error: Assertion failed (queryDescriptors.type() == trainDescCollection[0].type()) in knnMatchImpl, file /home/maxpower/opencv-2.4.6.1/modules/features2d/src/matchers.cpp, line 351 terminate called after throwing an instance of 'cv::Exception' what(): /home/maxpower/opencv-2.4.6.1/modules/features2d/src/matchers.cpp:351: error: (-215) queryDescriptors.type() == trainDescCollection[0].type() in function knnMatchImpl

Regards

edit retag flag offensive close merge delete

Comments

1

I hope Im right. I just checked it for the Orb descriptor. The Descriptor Mat has 32 cols and is of Type 0 which is CV_8U. So maybe you should initialize kdesc like this: Mat kdesc = Mat(0, 32, CV_8U) Maybe push_back works then. I didnt try the push_back though and the matching neither.

The cols number can vary btw, depending on the descriptor, but the type should be the same for any binary descriptor.

Moster gravatar imageMoster ( 2013-08-06 07:44:31 -0600 )edit