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();

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-, line 351 terminate called after throwing an instance of 'cv::Exception' what(): /home/maxpower/opencv- error: (-215) queryDescriptors.type() == trainDescCollection[0].type() in function knnMatchImpl


edit retag flag offensive close merge delete



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