imwrite and imshow problem

3 ビュー (過去 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 Center および File ExchangeConvert Image Type についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by