2

我正在尝试从视频的帧中制作训练数据集。

对于每个新帧,我都会找到特征向量(大小为3300X1)并与旧特征向量连接以制作训练数据集。但是在阅读了 2000 帧之后,我得到了低于指定的错误。

我在第二行的下面提到的代码中遇到错误,即

   cv::Mat frameFV = getFeatureVectorFromGivenImage(curFrame, width, height);
   cv::hconcat(trainingDataPerEmotion, frameFV, trainingDataPerEmotion);

在出现错误时,大小cv::Mat trainingDataPerEmotion3300X2000(nearly)

我正在使用发布旧视频

cvReleaseCapture(&capture);

在处理新视频之前。错误是

OpenCV Error: Insufficient memory (Failed to allocate 3686404 bytes) in OutOfMemoryError, file /home/naresh/OpenCV-2.4.0/modules/core/src/alloc.cpp, line 52
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/mario/OpenCV-2.4.0/modules/core/src/alloc.cpp:52: error: (-4) Failed to allocate 3686404 bytes in function OutOfMemoryError

任何人都可以建议我如何解决这个问题,我必须保存大量的训练数据来训练我的系统。

谢谢你。

4

1 回答 1

1

首先检查您是否有一些内存泄漏。据我记得,当发生一些分配问题时,实际上会引发 OpenCV OutOfMemory 错误。

如果您仍然无法弄清楚一些内存泄漏并找到案例,则必须提供更多代码。最好的是允许重现错误的代码。

于 2012-06-26T16:34:24.367 回答