Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Reason for size limit on imread

I have successfully written images with sizes of about 60000x30000 (1,800,000,000 pixels), but when reading the image with imread, I get an assertion from these defined limits in opencv/modules/imgcodecs/src/loadsave.cpp:

#define CV_IO_MAX_IMAGE_PARAMS (50)
#define CV_IO_MAX_IMAGE_WIDTH (1<<20)
#define CV_IO_MAX_IMAGE_HEIGHT (1<<20)
#define CV_IO_MAX_IMAGE_PIXELS (1<<30) // 1 Gigapixel

I'm wondering if there are specific requirements being met by these or if they're just arbitrarily defined. 1<<20 matches dimensions of 1,000,000, where 1<<16 = 65536 seems to make more sense.

It doesn't make sense to be able to write an image out of a certain size but be unable to read it.

Reason for size limit on imread

I have successfully written images with sizes of about 60000x30000 (1,800,000,000 pixels), but when reading the image with imread, I get an assertion from these defined limits in opencv/modules/imgcodecs/src/loadsave.cpp:

#define CV_IO_MAX_IMAGE_PARAMS (50)
#define CV_IO_MAX_IMAGE_WIDTH (1<<20)
#define CV_IO_MAX_IMAGE_HEIGHT (1<<20)
#define CV_IO_MAX_IMAGE_PIXELS (1<<30) // 1 Gigapixel

I'm wondering if Are there are specific requirements being met by these or if they're are these limits just arbitrarily defined. defined? In width and height for example, 1<<20 matches dimensions of 1,000,000, where 1<<16 = 65536 seems to make more sense. This is what leads me to believe they are arbitrarily defined. To be able to handle images up to a size of 65536x65536, CV_IO_MAX_IMAGE_PIXELS should be 2^32.

It doesn't make sense to be able to write an image out of a certain size but be unable to read it.