CV4.1: Failed Assertion in function detectAndCompute

asked 2019-07-13 07:30:41 -0500

A13XIS gravatar image

Hello World,

I'm curently working on a little algorithm using ORB. It has to recalculate keypoints and descriptors at some point, since their location and size change. However, calling detectAndCompute with the "useExistingKepoints"-flag on, fails at the assertion "level >= 0". I am confused, since there is no attribute called "level" in a keypoint or descriptor. My question is what exactly causes the assertion to fail and how to avoid that?


Fyi: Since trackers work with rectangular bounding boxes instead of circular Keypoints, I have to translate one in another.

Keypoint2BoundingBox:

//Create Rect2d with data from the keypoint. Orientation and octave don't need to be saved, since  the object gets reused
//kp: KeyPoint
Rect2d(round(kp.pt.x - kp.size / 2), round(kp.pt.y - kp.size / 2),
       round(kp.size), round(kp.size)));

BoundingBox2Keypoint

//obtain previous kp object and update it accordingly
//kp: KeyPoint;   rect: Rect2d
kp->size = int(round(max(rect->height,rect->width)));
kp->octave = int(round(size2Octave(kp->size, patchsize, scale)));
kp->pt = Point2f(int(round(rect->x-(rect->width/2))),int(round(rect->y-(rect->height/2))));

Size2Octave

//Uses keypoint size and some ORB parameters to compute the octave the keypoint would have
//size: Keypoint Size;   patchsize: size of keypoints at octave 0;   scale: stepsize to next octave
//returns fraction if Keypoint size is not multiple of patchsize
log10(size/patchsize)/log(scale);
edit retag flag offensive close merge delete