Why does MATLAB play with the contrast of my image after saving it?

6 vues (au cours des 30 derniers jours)
Ali Almakhmari
Ali Almakhmari le 21 Juil 2022
Commenté : Ali Almakhmari le 23 Juil 2022
I have a very weird problem that I hope someone can help me with. So Attached are two pictures of almost the exact same location in a map of a desert, one named "true" and one named "weird". The "true" image is the one I have and downloaded directly from the source in a tiff format. And the "weird" image is the true image taken into MATLAB with the following piece of code:
pictureData = imread("true.tiff");
h = imshow(pictureData);
imwrite(h.CData,"weird.tiff")
Now I don't understand why my map's colors are very slightly adjusted after saving the new image where the new image has lighter colors (the colors are almost the same I know...but still there is a noticeable difference that will skew my results)
I would like to do some analysis on my images but I am afraid that MATLAB will ruin my pictures and skew my results with this arbitrary change in colors. Is this because my images are gigantic (>50MB)? Or is it because I am saving those images incorrectly? I don't really know whats going.
  14 commentaires
DGM
DGM le 23 Juil 2022
Modifié(e) : DGM le 23 Juil 2022
I used the code as I posted above. I'm not sure what the difference is.
Difference in version/environment?
Difference between 'true.tiff' and 'true.jpeg'?
What happens if you try to save the file using imwrite() directly on pictureData instead of on h.Cdata?
Ali Almakhmari
Ali Almakhmari le 23 Juil 2022
I tried all your suggestions and they didn't help..except one. I think I will downgrade to MATLAB 2019b and see if it works. I really appreciate all your help. Let me know if you have any further suggestions.

Connectez-vous pour commenter.

Réponses (0)

Catégories

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

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by