Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Imread fails on a large (1GB) PGM file

I'm trying to load some large images into OpenCV, I have a ~gigapixel image taken from the HiRISE project. The files are in JP2 format which open fine in OS X Preview, but seem to crash both Jasper and OpenJPEG - and hence also crash OpenCV.

I've managed to convert them to PGM using Kakadu (see above, every other package crashes), but then I get an assertion failure (the file begins loading as I can see RAM usage going through the roof):

Assertion failed: (isOpened() && pos >= 0), function setPos, file /tmp/opencv-LZGjtm/opencv-2.4.9/modules/highgui/src/bitstrm.cpp, line 167

I assume the file is being opened, due to the RAM usage, so it looks like pos is the thing that's failing?

An example: http://hirise.lpl.arizona.edu/ESP_011277_1825

Is this likely to be a malformed image or something like lack of RAM? The link above contains a representative image so it should be possible to verify this (ideally on a machine with 8GB+ RAM).