Reason for size limit on imread [closed]
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
Are there specific requirements being met by these or are these limits just arbitrarily 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.