问题
I've been searching for days about this issue and didn't find any solved thread. I need loading pretty large images (4 GB and beyond, either .tiff / .png) into openCV code, by means of a simple
src = imread(filepath, 1);
I'm using Visual Studio 2013, C++.
Though I'm using a 96Gb-RAM machine, runtime alerts are coming out when loading these large images by OpenCV's "imread" function. Been trying with smaller and smaller images/files untill the point they are indeed read/loaded, so we know it's a matter of memory/allocation since smaller images are correctly loaded and processed.
Console is throughing the following message, extracted by "catch (...)"
OpenCV Error: One of arguments' values is out of range (The total matrix size does not fit to "size_t" type) in cv::setSize, file C:\builds\2_4_PackSlave-win32- vc12-shared\opencv\modules\core\src\matrix.cpp, line 126
On the other hand, VS2013 shows the following alert while running (no compilation issues at all):
Unhandled exception at 0x76385608 in poblacion.exe: Microsoft C++ exception: cv::Exception at memory location 0x00C7EA70
also arguing "no symbols loaded". We are compiling in Win32, Debug mode.
This issue is bug #3258 but no solved thread is found out there, just discussion regarging size_t type leading to no clear solution... There should be a way of reading large images without going through openCV libraries...
Did this happen to anybody there who can help us?? I will spread any satifying solution.
THANX in advance!
Alex
回答1:
size_t
size differs between Win32
and x64
platforms. Error tells that matrix dimensions do not fit in size_t
type.
Consider switching to x64
configuration and your problem should disappear.
In addition to that, Win32
configuration is not suitable for applications which are expected to use >4GB of RAM per process.
That means you will not be able to use the full power of your machine with 96GB RAM running Win32
application.
来源:https://stackoverflow.com/questions/45513840/opencv-imread-limit-for-large-or-huge-images-mat-bug-3258