Update: the colour discrepancy is gone if I save the orginal image as PNG and then read it using imread(). This means that the issue is in JPG lossy compression! But how would I resolve it without changing the format?
imread seems to alter the image saturation?
조회 수: 5 (최근 30일)
이전 댓글 표시
Why does the image read by imread() seem to have a reduced saturation compared to the original image? This also happens when the image is read through an imageDatastore object, I guess the underlying method is still imread(). The codes I used are included below:
img = imread("img_original.jpg");
figure, imshow(img)
which produce something like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1629641/image.jpeg)
while the original image file, open in FastStone looks like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1629646/image.jpeg)
You can also open the img_original.jpg to see it yourself.
While inspecting the histogram, I see that the blue channel has been altered the most when comparing to the histogram from FastStone. The original image seems to have a lot of blue pixels saturated at 0, while the Matlab's blue histogram shows a slight shift to the right. This is also evident from the red channel.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1629651/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1629656/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1629661/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1629666/image.jpeg)
Factors I have investigated include:
- bit-depth
- JPG format
- imread optional arguments
- Monitor display setting: the colour histogram is evident that colour has changed
- FastStone: I also tried the default Windows image viewer and it looks the same as in FastStone
Can someone please explain what may cause this colour discrepancy when I just simply read the image? Thank you!
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!