write an image file

2 vues (au cours des 30 derniers jours)
Elysi Cochin
Elysi Cochin le 1 Avr 2020
i have a image im of uint16 datatype
figure(1), imshow(im)
figure(2), imshow(uint8(im))
figure(3), imshow(im,[])
all the above lines displays the image in different format
How to write the image in as obtained in 3rd figure format
  2 commentaires
krishna kotha
krishna kotha le 1 Avr 2020
hii iam krishna
it is clearely mentioned in matlab help
Constantino Carlos Reyes-Aldasoro

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 1 Avr 2020
You need to scale it to 0-255 first (which is what [] does), and then cast to uint8:
image8 = uint8(rescale(im, 0, 255));
imwrite(filename, image8);

Plus de réponses (0)

Catégories

En savoir plus sur Convert Image Type dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by