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

5 Ansichten (letzte 30 Tage)
Ali Almakhmari
Ali Almakhmari am 21 Jul. 2022
Kommentiert: Ali Almakhmari am 23 Jul. 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 Kommentare
DGM
DGM am 23 Jul. 2022
Bearbeitet: DGM am 23 Jul. 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 am 23 Jul. 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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by