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

2 次查看(过去 30 天)
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 个评论
DGM
DGM 2022-7-23
编辑:DGM 2022-7-23
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 2022-7-23
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by