使用大量内存的 OpenCV 2.4.6 SIFT KeyPoints 检测 [英] OpenCV 2.4.6 SIFT KeyPoints Detection using a lot of memory

查看:110
本文介绍了使用大量内存的 OpenCV 2.4.6 SIFT KeyPoints 检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在 openCV 2.4.3 中使用 SIFT,我们决定升级到 openCV 2.4.6.升级后,openCV 2.4.6的内存使用量从大约(150MB)跃升至1.2GB.

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?

我们的图片有 1.4MB.在 iOS 上观察到此行为.这个问题似乎也发生在 Linux (CentOs) 中.

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

谢谢

推荐答案

我记得在其中一个版本中存在一个关于关键点提取的错误.我是用 ORB 看到的,所以我不知道这里是不是同样的问题,但我告诉你,以防万一它可以有任何帮助.

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

这篇关于使用大量内存的 OpenCV 2.4.6 SIFT KeyPoints 检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆