我目前正在使用ORB研究一种小算法。由于关键点和描述符的位置和大小会发生变化,因此必须在某个点重新计算。但是,在断言“级别> = 0”时,调用带有“ useExistingKepoints”标志的detectAndCompute失败。我很困惑,因为在关键点或描述符中没有称为“ level”的属性。我的问题是究竟是什么导致断言失败以及如何避免断言?
Fyi:由于跟踪器使用的是矩形边界框而不是圆形的关键点,因此我必须将它们相互转换。
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(此方法的结果传递给导致问题的ORB)
//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);
答案 0 :(得分:1)