3

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

the swine
  • 10,713
  • 7
  • 58
  • 100
Oberdan Nunes
  • 509
  • 4
  • 13
  • I have a similar problem using OpenCV 2.4.10 in Linux. The memory is correctly deleted afterwards so there is no memory leak, it's just that the process uses 17 MB of RAM alone and 1 GB when the feature detection is running. – the swine Oct 09 '14 at 14:29

2 Answers2

1

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);
}
ChronoTrigger
  • 8,459
  • 1
  • 36
  • 57
  • We had seen this same behavior, but it isn't the problem we are facing now. The huge memory usage occurs when we do the first Feature Detection, and when the detection completes, the huge allocated memory gets free. Tks. – Oberdan Nunes Sep 12 '13 at 15:59
  • Even though, I think your answer can help someone else. Tks +1; – Oberdan Nunes Sep 12 '13 at 16:00
  • And how many features do you get? Maybe the threshold values mean something different now and you are getting many more features than before. – ChronoTrigger Sep 12 '13 at 16:39
  • The detector parameters are the same, all with default values. I'm getting 8k KeyPoints in version 2.4.6 and 2k KeyPoints in version 2.4.3. – Oberdan Nunes Sep 12 '13 at 18:50
0

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

the swine
  • 10,713
  • 7
  • 58
  • 100
  • Great, the assigned person to resolve the bug did not log in for the past year. And I've lost password. Isn't that just grand? – the swine Oct 21 '14 at 08:49
  • Ok, they cancelled it as a duplicate of another issue, which they also cancelled as a duplicate of the first one. I give up. OpenCV team is retarded. – the swine Dec 03 '15 at 16:31
  • I'm so frustrated with the openCv too. On another note, I used to use the r-word until I came across this talk; including it here just in case you're interested: https://www.ted.com/talks/matthew_williams_special_olympics_let_me_be_myself_a_champion/transcript?language=en – oymonk Jul 06 '20 at 20:43