displaying a 512 *512 8 bpp image

조회 수: 3 (최근 30일)
tina jain
tina jain 2015년 4월 17일
답변: DGM 2022년 11월 13일
I am having two lena image
  1. lena256.bmp---> a 256 *256 image
close all;
clear all;
clc;
%--------Displaying Lena image which has 256*256 size
imData=imread('lena256.bmp');
imshow(imData);
figure(1);
title('Original image');
pause(2);
By using above code I am able to display the image.
2. lena_2.bmp----> 512 * 512 image
close all;
clear all;
clc;
%--------Displaying Lena image which has 256*256 size
imData=imread('lena_2.bmp');
imshow(imData);
figure(1);
title('Original image');
pause(2);
by using the above code, the image displaying is as follow
why is it so?? why second image is not correct

답변 (1개)

DGM
DGM 2022년 11월 13일
The image is an indexed image. You need the corresponding color map in order to do anything with it.
[A map] = imread('lena.bmp'); % read the image and the map
imshow(A,map); % use the map to display or write the image
In this case, the copy of lena.bmp appears to be a color image with a relatively short color table and no dithering. Be aware that there are many versions of this image floating around. Some are I/RGB; some are indexed grayscale or color with varying map lengths and dithering methods. Just because you have a file called 'lena.bmp' doesn't mean it's the same as something you see described in a code example on a forum somewhere.

카테고리

Help CenterFile Exchange에서 Import, Export, and Conversion에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by