imwrite and imshow problem

조회 수: 2 (최근 30일)
Paulo
Paulo 2011년 8월 25일
Here is my code: irisImage = imread('C:\Users\Tests\iris.bmp'); irisImageGrayScale = double(rgb2gray(irisImage)); figure;imshow(irisImageGrayScale) imwrite(irisImageGrayScale, 'C:\Users\Tests\irisGrayScaled.jpg','jpg');
The image being recorded is not the grayscale of the iris.bmp but instead, an image with white background and small dots on the center. The imshow also is the same but when I change imshow and use
imshow(irisImageGrayScale, [])
the correct gray scale of the picture is showed

답변 (1개)

Sean de Wolski
Sean de Wolski 2011년 8월 25일
Yes, by viewing with imshow and the [] (full range) option you're seeing the full range of values. Otherwise, you're seeing only the values between zero and one which most of the uint8 values will be above. I would recommend trying im2double if you need to save. Or just converting back to uint8 before saving and/or never converting to double in the first place. The only reason to convert to double is if you want to do math on the image.

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by