2012-06-26 76 views
1

我试图从视频的帧中制作训练数据集。opencv中的内存不足错误

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

,我得到错误在第二行下面mentione代码,即

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

在得到错误的cv::Mat trainingDataPerEmotion大小的时间是3300X2000(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 

任何一个可以建议我,我怎么能到这儿来这个问题,我必须救大训练数据,训练我的系统。

谢谢。

回答

1

先检查是否没有内存泄漏。 据我记得,当分配发生一些问题时,OpenCV OutOfMemory错误会被抛出。

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