Hi,
This isn't exactly related an existing OpenCV module, but I'm trying to run the DBREIF descriptor that is based on OpenCV. Unfortunately, the code uses the old C api.
Here's where I get the exception:
void Dbrief::getDbriefDescriptor(bitset<DESC_LEN>& desc, cv::KeyPoint kpt, IplImage* img)
{
// Calculate the width step of the boxSmoothedImage image
int inWS = boxSmoothedImage->step / CV_ELEM_SIZE(boxSmoothedImage->type);
// Hold the pointer of the data part of boxSmoothedImage image matrix with "iD"
float* iD = boxSmoothedImage->data.fl;
// Hold the pointer to the top left corner of the patch to be analysed
int X = kpt.pt.x - HALF_PATCH_SIZE,
Y = kpt.pt.y - HALF_PATCH_SIZE;
cv::Point2i point;
float result;
GET_MATRIX_DATA(iD, 488 + 32, 603 + 1, 765); /// HERE IS EXCEPTION
/***********************************************
Here's the function that calls this function:
void Dbrief::getDbriefDescriptors(vector< bitset<DESC_LEN> >& descriptors,
vector<cv::KeyPoint>& kpts,
IplImage* img)
{
// Make sure that input image contains only one color channel:
assert(img->nChannels == 1);
// Check whether all the keypoints are inside the subimage:
assert(validateKeypoints(kpts, img->width, img->height));
// If memory allocated in 'descriptors' is not enough, then resize it:
descriptors.resize(kpts.size());
// Allocate memory for the box smoothed image
allocateBoxSmoothedImage(img);
// Calculate the box smoothed image:
cvSmooth(img, boxSmoothedImage, CV_BLUR_NO_SCALE, KERNEL_SIZE, KERNEL_SIZE);
// Iterate over keypoints:
for (unsigned int i = 0; i < kpts.size(); ++i){
printf("%d\n", i);
getDbriefDescriptor(descriptors[i], kpts[i], img);
}
}
Now, in the first 24 times the function "getDbriefDescriptor(descriptors[i], kpts[i], img);" is called, there is no exception, only in the 24'th time. The size of boxSmoothedImage is width=765 and height = 512.
I'm stumped. Why an exception rises in the exact same command, only in the 24'th time the function is called? It has to do with something related to memory management, but I'm not sure what.
Any help will be greatly appreciated.
Thanks,
Gil