gamma correction - using MATLAB vs. using hardware settings
3 views (last 30 days)
Show older comments
I have a 8-bit monitor (or 32-bit it we consider all colors and alpha).
Lets say I have a grayscale image, with colors I would like to plot.
However, I would like to gamma correct the image, so that the users view the plot in a linear scale.
img = uint8(0:255);
img_corrected = unique(round(im2uint8(im2double(img).^(1/2.2))));
length(img)
length(img_corrected)
As you can see, there is a problem here. The corrected colormap has less colors than the original colormap, because the non-linear gamma transformation compressess the dark colors, which are rounded to the same integers and lost. This is expected.
What I want to know, is if there is any way to avoid this problem.
I know my LCD monitor has a linear relationship between voltage and luminance, and the gamma is only applied for convenience and back compatibility with CRT monitors.
There are 3 ways I can perform the gamma correction, in my 8-bit monitor:
1 - The method I did here, using MATLAB to do the gamma correction, with the problem I mentioned.
2 - Use my monitor hardware configurations to change the gamma to 1.
3 - Use an external software to do the gamma correction, for example the NVIDIA control panel.
What I want to know is that, if I use options 2 or 3, I will suffer the same problem I mentioned here. If I change the gamma directly at the monitor settings, then I don't need to use that round operation anymore, because the relationship will now be linear inside MATLAB. So I should not lose those 74 colors. Or I am wrong? Can somone expert in the filed help me with this?
0 Comments
Answers (0)
See Also
Categories
Find more on Particle & Nuclear Physics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!