imread not reading in BMP [closed]

asked 2015-11-13 11:08:58 -0600

KvltKitty gravatar image

Hello all,

I'm trying to read in a .bmp file using the following code:

cv::Mat image1 = cv::imread("SmallDog.bmp", CV_LOAD_IMAGE_COLOR);

And it is failing everytime. I can read in .jpg files just fine, but I need to load in a bmp file, as the noise library and texture generator I have writes to .bmp files and I plan to stitch generated bmp textures together. I can't get past this though -_- Any suggestions you may have are greatly appreciated

And yes, the directory location in Visual Studio is fine. I tested it with a few different file formats, and .bmp is the only one giving me issues (of course the one I need haha)

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-09-27 08:58:17.931708

Comments

If you have check pass( mean in same folder you can read SmallDog.jpg and not SmallDog.bmp). Can you read with paint? I can read bmp image on windows 10 wit vs 2013 and opencv 3.0 using flag cv::IMREAD_UNCHANGED. But I don't think changing flag will change results.

bmp decoder is in file opencv\modules\imgcodecs\src\grfmt_bmp.cpp

LBerger gravatar imageLBerger ( 2015-11-13 11:29:42 -0600 )edit

I'm running opencv 2.4.9 Could this be an issue?

Also yeah for some reason even if I open up the bmp in paint, save it out as a jpg and try and load it it still won't work. I can load an image that was originally a jpg that I downloaded online just fine though

KvltKitty gravatar imageKvltKitty ( 2015-11-13 11:37:23 -0600 )edit

About opencv 2.4.9 my level is before beginner I cannot help you.

Which is your platform windows or linux?

LBerger gravatar imageLBerger ( 2015-11-13 11:53:02 -0600 )edit

What is the error mesage? Maybe it is not a 8-bit image

bhoke gravatar imagebhoke ( 2015-11-13 17:24:37 -0600 )edit