Monitor Gamma Calibration (manual and grayscale)

14 Ansichten (letzte 30 Tage)
Yuval
Yuval am 12 Jun. 2025
Bearbeitet: Adam Danz am 17 Jun. 2025
Hello everyone,
Would like your help with monitor gamma calibration:
  1. Does anybody have a script that helps doing gamma calibration manually with a photometer (grayscale, not colors), and creates a gamma table which can be used in experiments?
  2. I created a script with GPT, did a calibration with a photometer and got gamma value of 1.98. when I use the gamma table in my experiment, the the monitor seems much brighter and the stimuli are harder to distinct (it seems like the contrast decreased). Does it make sense?
Thanks in advance :)
  2 Kommentare
Adam Danz
Adam Danz am 12 Jun. 2025
I have a few ideas that would explain the results you describe but rather than speculating, how are you using this gamma value?
Yuval
Yuval am 17 Jun. 2025
I mostly tried creating gamma table using this script:
gammaGray = 1.98;
gammaTableSafe = repmat(linspace(0, 1, 256)'.^gammaGray, 1, 3);
save('gammaTableSafe.mat', 'gammaTableSafe');
Then in the experiment itself I load and use the table like that:
load('gammaTableSafe.mat');
Screen('LoadNormalizedGammaTable,wPtr, gammaTableSafe');
This results in a brighter screen. does it seem right?
And thank you for your time! 🙏

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Adam Danz
Adam Danz am 12 Jun. 2025
Bearbeitet: Adam Danz am 12 Jun. 2025
I believe this describes your setup; please correct me if I'm wrong.
  1. You sent grayscale RGB values from MATLAB to your monitor. e.g. [.2 .2 .2]; [.7 .7 .7]; etc
  2. In a controlled dark room you used a photometer orthogonal to the monitor surface to measure the luminance of the monitor for each grayscale value.
  3. The relationship between the rgb inputs and outputs resulted in a gamma value of 1.98 which is within a reasonable range.
  4. You applied a gamma correction to the RGB inputs in MATLAB using a power of 1/1.98. This essentially linearlizes the relationship between the RGB values sent from MATLAB and intensity outputs of the monitor.
If that's the case, you could use the photometer with the gamma corrected RGB values to confirm a gamma value at or near 1.0. That would confirm that the RGB values are directly controlling pixel intensity.
Let's see what that looks like. Here's a grayscale image at baseline.
I=imread('pout.tif');
Idbl = double(I)./double(intmax(class(I))); % normalized values [0,1]
imshow(I)
And here's the linearized result.
Ilin = Idbl .^ (1/1.98);
imshow(Ilin)
If the calibration and gamma correction were applied correctly, and if the monitor doesn't have any unepxected settings etc, then the range of intensities in this image are linearlized meaning that there's a linear relationship between the grayscale inputs and the intensity measured by the photometer.
But why does it appear lighter?
Human vision applies it's own version of a gamma transformation to light intensities. Our vision is much more sensitive to lower intensities. An example of this nonlinearity: a room lit by two candles is brighter than a room lit by one candle but a room lit by 51 candles is not perceptually different from a room lit by 50 candles (but it would be different for a photometer). See also the Weber-Fechner law.
By applying the gamma correction (1/1.98) to the RGB values you are controling the physical luminance of the stimuli and linearlizing the relationship between the inputs (RGB values) and outputs (physical intensity) such that a change in grayscale values is proportional to the physical change in light intensity. This shifts intensities upward and negates the monitor's gamma transformation that we typically rely on to perceive the intended pixel intensities.
Does this match your setup? If so, after applying the gamma correction, use the photometer and calibration process again to confirm that your gamma value is ~1.0.
See also rgb2lin, lin2rgb
  2 Kommentare
Yuval
Yuval am 17 Jun. 2025
Wow, thank you! that is very helpful!
I will try to test it with the photometer.
So the table I create for the experiment should be computed in this way? ->
gammaGray = 1.98;
levels = linspace(0, 1, 256)';
invGammaVec = levels.^(1/gammaGray);
gammaTableSafe = repmat(invGammaVec, 1, 3);
save('gammaTableSafe.mat', 'gammaTableSafe');
Adam Danz
Adam Danz am 17 Jun. 2025
Bearbeitet: Adam Danz am 17 Jun. 2025
Yes, that seems reasonable. If the gamma value using the linearized RGB values is not ~1.0, then something isn't right.
I'm interested in what you find.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by