Insufficient memory loading moderately large images

asked 2013-06-14 12:19:20 -0600

thanksforhelp gravatar image

updated 2013-06-14 12:35:08 -0600

Hello All,

I have to manipulate moderately large images, tiffs around 6kx6k 120meg to 12k by 12k and 400meg. I am able to load and manipulate them with Python Image Library and ImageMagick. When I go to load them in OpenCV however, I get the following error.

original_bgr = cv2.imread('59261I_small.TIF', 1 ) OpenCV Error: Insufficient memory (Failed to allocate 127332004 bytes) in unknown function, file ......\src\opencv\modules\core\src\alloc.cpp, line 52 Traceback (most recent call last): File "<stdin>", line 1, in <module> cv2.error: ......\src\opencv\modules\core\src\alloc.cpp:52: error: (-4) Failed to allocate 127332004 bytes

I'm running Python 2.7.5 32 bit, the latest opencv build, winpython and spyder, on 64 bit win 7. I have 128 gigs of ram, though I know I can't access that because of the 32 bit opencv.

I am able to load smaller images with opencv just fine.

Thanks for any suggestions you can provide.

edit retag flag offensive close merge delete

Comments

as i don't think, there's a "coding" solution to this,

try to make an issue, here

berak gravatar imageberak ( 2013-06-14 12:27:26 -0600 )edit

You might very well be right.

In terms of a "coding" solution, I have read several posts about out of memory errors where people have discussed (1) A hard coded size limit - only seemed to apply to cv not cv2 and was at a gig anyway (2) Memory fragmentation - which shouldn't be a problem but might explain why the error is hit or miss working sometimes and not others (3) Garbage collection

I'm really looking for a primer of how these (or more relevant) issues might cause this error with loading an image and how a newbie should go about troubleshooting them.

thanksforhelp gravatar imagethanksforhelp ( 2013-06-16 13:01:57 -0600 )edit