OpenCV 2.4.6 SIFT KeyPoints Detection using a lot of memory

与世无争的帅哥 提交于 2019-12-05 02:24:27

问题


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


回答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);
}



回答2:


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



来源:https://stackoverflow.com/questions/18765406/opencv-2-4-6-sift-keypoints-detection-using-a-lot-of-memory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!