删除 OpenCV 图像大小限制 [英] Remove OpenCV image size limitation
问题描述
我正在加载一个非常大的图像(60,000 x 80,000 像素)并且超出了我可以加载的最大像素:
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'
据我所知,这是指对 第 65 行
理想情况下,我会改变它以处理至少 5 千兆像素的图像
Ideally I'd change that to deal with at least 5 gigapixel images
#define CV_IO_MAX_IMAGE_PIXELS (1<<33)
我已经看到了一些解决方法(OpenCV 图像大小限制)但那些没有t 似乎解决了一个任意定义的问题(我正在使用 700gb ram 的高性能服务器,因此计算不是问题).
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).
我的问题是我不知道这个文件在哪里.该错误将我指向这个travis"目录,该目录对我来说在本地不存在,并且在我的本地环境中,C++ 文件不可用.
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.
知道在哪里可以找到 C++ 库吗?
Any idea on where to look to find the c++ library?
推荐答案
你必须修改 openCV 源文件,然后自己编译.
You have to modify the openCV source files and then compile it your own.
您还可以修改环境变量
export CV_IO_MAX_IMAGE_PIXELS=1099511627776
这篇关于删除 OpenCV 图像大小限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!