Skip to content

OpenCV 4.11.0 broken on s390x (big endian) - cv::imread returns empty matrix for valid file #26913

@AdamWill

Description

@AdamWill

System Information

OpenCV 4.11.0 seems to be broken on s390x (notably, the only big-endian arch we - Fedora - test). When our OpenCV package was updated to 4.11.0, the tests of os-autoinst (part of the openQA test framework) started failing on s390x only. The failure seemed to point to OpenCV, because it looked like the operation that was failing was just reading an image with OpenCV.

Detailed description

It looks like img = cv::imread("/var/tmp/bootmenu.test.png", cv::IMREAD_COLOR); - where that's a perfectly valid PNG file - returns an empty matrix on s390x with OpenCV 4.11.0. On x86_64 (or any other LE arch), it works. On s390x with OpenCV 4.10.0, it works.

Steps to reproduce

Here's a minimal reproducer I hacked up to prove the point - apologies for any weirdness, I am not really a C++ coder:

#include <opencv2/imgcodecs.hpp>
#include <opencv2/core/mat.hpp>
#include <iostream>

int main() {
    cv::Mat img;
    img = cv::imread("/var/tmp/bootmenu.test.png", cv::IMREAD_COLOR);
    if (!img.data) {
        std::cout << "Failed\n";
    }
    else {
        std::cout << "Succeeded\n";
    }
}

Obviously, you need /var/tmp/bootmenu.test.png to be a valid PNG file, in the original test it is this one. The compile command I used is:

g++ -I /usr/include/opencv4 -o cvtest cvtest.cpp /usr/lib64/libopencv_imgcodecs.so.4.11.0 /usr/lib64/libopencv_core.so.4.11.0

obviously adjust the paths and filenames as appropriate for your test environment (of course the library filenames had 4.10.0 in them when testing 4.10.0).

When I compile and run that test script on s390x with OpenCV 4.11.0 (Fedora Rawhide clean build environment), it prints "Failed". On s390x with OpenCV 4.10.0, and on x86_64 with either version of OpenCV, it prints "Succeeded".

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions