Skip to main content
Skip table of contents

Generate and apply a gamma-correction CLUT

Open MATLAB again, and this time, load GenerateInverseCLUTFromGamma.m. There is only one user set variable, gamma, where you should replace the stand-in value with the estimated gamma coefficient obtained in the previous step.

When you execute the script, it will load all relevant results from mySampledLuminance.mat and use the estimated gamma to return a pre-formatted gamma-correction CLUT. The result will be automatically presented in a new figure. This gamma-correction CLUT will be saved in inverseCLUT.mat.

You can now close GenerateInverseCLUTFromGamma.m and reopen i1_SampleLuminance.m.

Using the estimated gamma, we generate the inverse gamma function that will be used to linearize the luminance of the display.


To apply the inverse CLUT, reopen i1_SampleLuminance.m, but this time, change ModeMeasure to ‘linearize’. This will ensure that all relevant results from previous steps are loaded. This will also ensure that the gamma-correction CLUT is applied to the stimulus window before taking any luminance measurements.

%% User set variables are: 
ModeMeasure = 'linearize'; %'linearize'
nPatches = 32; % 32 luminance patches will be measured
preparationTime = 5; % 5 seconds

Execute the script. A new figure will appear, and it should now be obvious that the raw luminance of your display was linearized during the measurements. 

You can use MATLAB’s built-in linear curve-fitting tools (tools –>  basic fitting -> plot fit linear) to look at your results, and examine the linear fit and the magnitude of the residuals. Ensure that any remaining non-linearity is acceptable for your research.

After executing i1_SampleLuminance.m with ModeMeasure = ‘linearize’, examine the results of the linearization with MATLAB’s built-in linear fit tools.

Note that after the measurements were acquired on the linearized display, i1_SampleLuminance.m removes the gamma-correction CLUT. If the gamma-correction CLUT was still active after the measurements were taken, your desktop environment would appear as if the colours had been slightly washed-out.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.