Loading large images - OpenCV Error: Insufficient memory
Hello all,
I am trying to read a large image in OpenCV & Qt 5.7 (32bit). This is the code I'm running:
#include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char *argv[]){
Mat mat = imread("C://Users//Z//Documents//test//3_dsm_ortho//2_mosaic//test_transparent_mosaic_group1.tif");
return 0;
}
When I run it, I get the following error:
OpenCV Error: Insufficient memory (Failed to allocate 1116737892 bytes) in OutOfMemoryError
How can I read large images in OpenCV?
Bellow are additional information about my image & PC.
Image Specs
- Size: 18806 x 19794
- Bit Depth: 32
- Memory size: 467 MB
- Type: TIFF Image
- Photometric Interpretation: RGB
PC Specs
- RAM: 6GB
- RAM used before running the code: 2.62 GB
- 64 bit
18806 x 19794 x 4 =1488960000 ~1.39GB and read this post and this issue