Ask Your Question

Revision history [back]

May be it's a bug and you can post an issue I tried this :

    Mat m = Mat::ones(60000, 40000, CV_8UC3);
    imwrite("test.png", m);
    Mat p = imread("test.png", IMREAD_UNCHANGED);
    cout << p.rows << " " << p.cols;

and an exception is thrown. Now I changed in source code

#define CV_IO_MAX_IMAGE_PIXELS (1<<30) // 1 Gigapixel

in

#define CV_IO_MAX_IMAGE_PIXELS (1ull<<32ull) // 1 Gigapixel

and no exception is thrown

May be it's a bug and you can post an issue I tried this :

 RNG r;
    Mat m = Mat::ones(60000, m(60000, 40000, CV_8UC3);
    r.fill(m, RNG::UNIFORM, 0, 255);
    imwrite("test.png", m);
    Mat p = imread("test.png", IMREAD_UNCHANGED);
IMREAD_UNCHANGED),d;
    cout << p.rows << " " << p.cols;
    absdiff(m, p, d);
    Scalar v = mean(d);
    cout << " mean=" << v << "\n";

and an exception is thrown. thrown (opencv 4.0.0 windows 10 visual 2017) Now I changed in source code

#define CV_IO_MAX_IMAGE_PIXELS (1<<30) // 1 Gigapixel

in

#define CV_IO_MAX_IMAGE_PIXELS (1ull<<32ull) // 1 Gigapixel

and no exception is thrown

May be it's a bug and you can post an issue I tried this :

    RNG r;
    Mat m(60000, 40000, CV_8UC3);
    r.fill(m, RNG::UNIFORM, 0, 255);
    imwrite("test.png", m);
    Mat p = imread("test.png", IMREAD_UNCHANGED),d;
    cout << p.rows << " " << p.cols;
    absdiff(m, p, d);
    Scalar v = mean(d);
    cout << " mean=" << v << "\n";

and an exception is thrown (opencv 4.0.0 windows 10 visual 2017) Now I changed in source code

#define CV_IO_MAX_IMAGE_PIXELS (1<<30) // 1 Gigapixel

in

#define CV_IO_MAX_IMAGE_PIXELS (1ull<<32ull) // 1 Gigapixel

and no exception is thrownthrown (after opencv rebuild)

May be it's a bug and you can post an issue I tried this :

    RNG r;
    Mat m(60000, 40000, CV_8UC3);
    r.fill(m, RNG::UNIFORM, 0, 255);
    imwrite("test.png", m);
    Mat p = imread("test.png", IMREAD_UNCHANGED),d;
    cout << p.rows << " " << p.cols;
    absdiff(m, p, d);
    Scalar v = mean(d);
    cout << " mean=" << v << "\n";

and an exception is thrown (opencv 4.0.0 windows 10 visual 2017) 2017 win64) Now I changed in source code

#define CV_IO_MAX_IMAGE_PIXELS (1<<30) // 1 Gigapixel

in

#define CV_IO_MAX_IMAGE_PIXELS (1ull<<32ull) // 1 Gigapixel

and no exception is thrown (after opencv rebuild)

May be it's a bug and you can post an issue I tried this :

    RNG r;
    Mat m(60000, 40000, CV_8UC3);
    r.fill(m, RNG::UNIFORM, 0, 255);
    imwrite("test.png", m);
    Mat p = imread("test.png", IMREAD_UNCHANGED),d;
    cout << p.rows << " " << p.cols;
    absdiff(m, p, d);
    Scalar v = mean(d);
    cout << " mean=" << v << "\n";

and an exception is thrown (opencv 4.0.0 windows 10 visual 2017 win64) Now I changed in source code

#define CV_IO_MAX_IMAGE_PIXELS (1<<30) // 1 Gigapixel

in

#define CV_IO_MAX_IMAGE_PIXELS (1ull<<32ull) // 1 Gigapixel

and no exception is thrown (after opencv rebuild)

PR https://github.com/opencv/opencv/pull/13382 and now in imread doc :

By default number of pixels must be less than 2^30. Limit can be set using system variable OPENCV_IO_MAX_IMAGE_PIXELS