Ask Your Question
0

OpenCV 3.1.0 Insufficient Memory

asked 2016-06-20 15:52:53 -0600

oweiss gravatar image

I'm using OpenCV 3.1.0, Python 3.5.1, and Windows 7. I'm trying to process 55 images, each about 4.5 MB, but every time I try to process/modify more than about 10 of them I get an insufficient memory error. I've recreated the issue with a simple piece of code:

import os
import cv2

images = []
for name in os.listdir("ImageStacking"):
    if name != "_DS_Store":
        images.append(cv2.imread("ImageStacking\\" + name))

ImageStacking is the file that contains my pictures. The error I receive is this:

OpenCV Error: Insufficient memory (Failed to allocate 53747712 bytes) in cv::OutOfMemoryError, file D:\Build\OpenCV\opencv-3.1.0\modules\core\src\alloc.cpp, line 52

OpenCV Error: Assertion failed (u != 0) in cv::Mat::create, file D:\Build\OpenCV\opencv-3.1.0\modules\core\src\matrix.cpp, line 424

I found a similar error here, with a fix for OpenCV 3.0: http://code.opencv.org/issues/3470 But I can't find a fix for OpenCV 3.1.

edit retag flag offensive close merge delete

Comments

2

maybe you will find the answer here

sturkmen gravatar imagesturkmen ( 2016-06-20 21:32:08 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-06-20 22:19:08 -0600

Dinh Thap gravatar image

I show you some way to fix in java. Maybe help you resolve the problem. 1. Increase memory of app. Example Java only uses 25% RAM. Better if you increase it. 2. If you allocating memory for any instance (ex: Mat,....). Then Let release it to free memory.

edit flag offensive delete link more

Comments

Unfortunately, I'm coding in Python - I don't think I can free memory.

oweiss gravatar imageoweiss ( 2016-06-21 12:35:34 -0600 )edit

Hmm. I only suggest for you some way. You think you can't! That's your think. Here you are: Free momory. Then you can force the Garbage Collector to release unreferenced memory with gc.collect(). In Java System.gc, in python gc.collect().

Dinh Thap gravatar imageDinh Thap ( 2016-06-21 23:40:48 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-06-20 15:52:53 -0600

Seen: 4,725 times

Last updated: Jun 20 '16