Bitmap contrast issue
显示 更早的评论
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?
采纳的回答
更多回答(1 个)
Walter Roberson
2011-6-24
BMP files can have color palettes stored, and indeed must use such palettes when they are less than 8 bits deep. A color palette corresponds to MATLAB's colormap.
[YourImage, YourColormap] = imread('example.bmp');
image(YourImage);
if ~isempty(YourColorMap); colormap(YourColorMap); end
类别
在 帮助中心 和 File Exchange 中查找有关 Contrast Adjustment 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!