Remove OpenCV image size limitation

Jono_R :

I am loading in a very large image (60,000 x 80,000 pixels) and am exceeding the max pixels I can load:

cv2.error: OpenCV(4.2.0) /Users/travis/build/skvark/opencv-python/opencv/modules/imgcodecs/src/loadsave.cpp:75: 
    error: (-215:Assertion failed) pixels <= CV_IO_MAX_IMAGE_PIXELS in function 'validateInputImageSize'

From what I have found this is referring to the limitation imposed on line 65

Ideally I'd change that to deal with at least 5 gigapixel images

#define CV_IO_MAX_IMAGE_PIXELS (1<<33)

I have seen some workarounds for this (OpenCV image size limit) but those don't seem to address the problem which is an arbitrary definition (I'm working off a high performance server with 700gb ram so compute not an issue).

My issue is that I have no idea where this file is. The error points me towards this "travis" directory which doesn't exist locally for me and in my local environment the c++ files aren't available.

Any idea on where to look to find the c++ library?

Ajai :

You have to modify the openCV source files and then compile it your own.

EDIT: You can also modify environment variables

export CV_IO_MAX_IMAGE_PIXELS=1099511627776

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=386513&siteId=1