简体   繁体   中英

OpenCV Error: Insufficient memory

I'm developing a project with opencv 2.3 in c++ style.

In the application I load a video and process every frame and do some stuff with the Mat object. After some time I get a Insufficient memory Error.

I capture the frame like:

FCapture >> FImage; 
FDetector->execute(FImage); 

In the execute I copy the image and save it in a std::Vector list. And also check the imageblobs like:

vector<vector<Point> > contours; 
findContours(FImage, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE); 

I know its a bit difficult to answer where the problem could be, but it's impossible to post here to whole program code. Maybe someone could tell me where I have to be careful to copy Mat objects or other OpenCv object that could be the reason of the error.

Interesting:

In the execute I copy the image and save it in a std::Vector list

and this statement as well:

After some time I get a Insufficient memory Error.

OpenCV images can be quite big depending on their size, and based on what you said, I think that your vector is growing faster then you can remove data from it , causing the insufficient memory error.

Makes sense right? If you keep adding data to the vector, one day you'll run out of memory to store new data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM