2012-06-26 77 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錯誤會被拋出。

如果仍然無法找出內存泄漏並找到案例,則必須提供更多代碼。最好的代碼將允許重現您的錯誤。