MATLAB: Bitmap contrast issue

binarybitmapbmpcontrastconvertgrayscaleimageimreadprocessing

When I use the imread function to open a grayscale .bmp image, the contrast displayed is far darker than the original image, which causes problems for image processing. Converting the image to .jpeg eliminates the contrast issue, but I have several thousand images to read and I don't want to have to convert them all. Is there a way to get MATLAB to read .bmp files correctly?

Best Answer

Are you sure it's not reading them correctly but you're just viewing a small range?
try:
imshow(imread('example.bmp'),[]); %whole range
Edition:
What class is the bitmap file?
I = imread('example.bmp');
class(I)
and then what class is the corresponding JPG file?
I = imread('sameexample.jpg');
class(I)