OpenCV 2.4.6 SIFT KeyPoints Detection using a lot of memory

1.5k views Asked by At

We were using SIFT in openCV 2.4.3 and we decided to upgrade to openCV 2.4.6. After the upgrade, the memory usage jumped from about (150MB) to 1.2GB in openCV 2.4.6.

Does someone knows if is this a bug or something that we need to configure now?

Our image has 1.4MB. This behavior was observed on iOS. The problem seems to be happening also in Linux (CentOs).

Tks

2

There are 2 answers

4
ChronoTrigger On

I remember there was a bug in one of those versions regarding keypoint extraction. I saw it with ORB, so I don't know if it is the same problem here, but I tell you in case it can be of any help.

The problem was that the keypoint extractor didn't clear the output vectors before extracting new keypoints:

vector<cv::KeyPoint> keys;
cv::Mat descs;
cv::ORB orb;

for(...)
{
  orb(image, mask, keys, descs); // bug: keypoints were accumulated in "keys"
}

I had to patch it like this:

for(...)
{
  keys.clear();
  descs.release();
  orb(image, mask, keys, descs);
}
3
the swine On

I have submitted a bug report with OpenCV. Now just wait and see ...