Help with gray scale images

조회 수: 1 (최근 30일)
Amateuromania
Amateuromania 2011년 6월 9일
I have a gray scale image which I after thresholding and histogram equalization write using imwrite. But when I read back this stored image, the gray scale values change. 255 changes to 63 and so on. The data type I am using in imread is uint8 type and if I use double, the entire image is white except the pixels having 0 value. I am unable to store the intermediate images. Please can anyone tell me why this is so?
Thanks in advance

채택된 답변

Sean de Wolski
Sean de Wolski 2011년 6월 9일
If you could show us the code with a sample image (e.g. 'cameraman.tif') it would help us.
More than likely when you're viewing it as double, the view range is set from [0 1] so everything 1 or greater (all values in uint8) appear white. Use the second input argument to imshow to change this, e.g:
Igraydouble = double(imread('cameraman.tif'));
figure;
subplot(121)
imshow(Igraydouble)
subplot(122)
imshow(Igraydouble,[])
  댓글 수: 7
Amateuromania
Amateuromania 2011년 6월 9일
no it's not what i meant
when you read the image stored by imread and then imshow, you see a very different image than the one shown by any image viewer like picasa. I'm asking whether the image viewer is showing the different picture because of the graymap used in imwrite
Sean de Wolski
Sean de Wolski 2011년 6월 9일
yes, the result of gray2ind

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Amateuromania
Amateuromania 2011년 6월 9일
the second argument [] only helps in display. The matrix value remains unchanged, i.e, 63 and not 255. How is 255 getting replaced by 63 in uint8?

카테고리

Help CenterFile Exchange에서 Red에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by