Skip to content

BMP image not loading correctly #23445

@tantei3

Description

@tantei3

System Information

OpenCV version: 4.7.0
Operating System: Arch Linux
Compiler: GCC 12.2.1

Detailed description

For this particular BMP image (attached as a gz file since Github is not allowing BMP upload)
output.bmp.gz

OpenCV is not able to load that particular image correctly. When loading with image = imread( argv[1], IMREAD_UNCHANGED ); I see very dark image with low brightness:
image

and when loading with image = imread( argv[1], IMREAD_COLOR ); I see the below:
image

Both of which are different from normally what MacOS image viewer or Eye of Mate on Linux shows:
image

Steps to reproduce

Load the output.bmp image via the below c++ opencv program and change the imread argument to observe the image displayed.

#include <iostream>
#include <cstdio>
#include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char** argv )
{
    if ( argc != 2 )
    {
        printf("usage: DisplayImage.out <Image_Path>\n");
        return -1;
    }
    Mat image;
    //image = imread( argv[1], IMREAD_COLOR );
    image = imread( argv[1], IMREAD_UNCHANGED );
    if ( !image.data )
    {
        printf("No image data \n");
        return -1;
    }
    namedWindow("Display Image", WINDOW_AUTOSIZE );
    imshow("Display Image", image);
    waitKey(0);
    return 0;
}

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