MATLAB: Does the bitmap image appear incorrectly when I display it using IMSHOW in Image Processing Toolbox 6.1 (R2008a)

bmpImage Processing Toolboximreadresolution

I am reading in an image file using IMREAD, and then displaying it using IMSHOW. However, it appears very grainy. For example, if I have a file test.bmp:
imagedata = imread('test.bmp');
imshow(imagedata);
Why is my image displayed incorrectly?

Best Answer

Some bitmap files have an associated color map with them. Both the image data as well as the color map data must be read in and passed into IMSHOW. The image should display correctly if the following code is used to read and display the image:
[imagedata imagemap] = imread('test.bmp');
imshow(imagedata, imagemap);