Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

opencv imwrite unable to save images >40MP

Hi,

I have a camera capable of 41.5MP. When I try to save an image from the camera it gets created, only that the image is 0KB in size, there is no error caught. If I save a region from the image then the image is saved correctly (as in the code below). Is there some limit to image size above which the image cannot be saved? (I am using version 4.0.1 opencv on Windows 10 and VC++ 17)

cv::Mat im = grabCVImage();


int s = 1200;
roi.x = s;
roi.y = s;
roi.width = s;
roi.height = s;


try {
    imwrite("C:\\Users\\Watts\\Pictures\\alpha.png", im(roi));
}
catch (std::runtime_error& ex) {
    fprintf(stderr, "Exception converting image to PNG format: %s\n", ex.what());
    return 1;
}