imwrite and imshow problem

1 visualizzazione (ultimi 30 giorni)
Paulo
Paulo il 25 Ago 2011
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

Risposte (1)

Sean de Wolski
Sean de Wolski il 25 Ago 2011
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.

Categorie

Scopri di più su Convert Image Type in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by