~ubuntu-branches/ubuntu/trusty/psychtoolbox-3/trusty-proposed

« back to all changes in this revision

Viewing changes to Psychtoolbox/PsychDemos/CalDemo.m

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2013-11-19 23:34:50 UTC
  • mfrom: (3.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20131119233450-f7nf92vb8qavjmk8
Tags: 3.0.11.20131017.dfsg1-3
Upload to unsable since fresh glew has arrived to sid!

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
title('Device Gamma');
65
65
 
66
66
%% Gamma correction without worrying about color
67
 
% Show how to linearize a gamma table, assuming 8-bits channel in the frame
68
 
% buffer (256 entry lookup table for each channel).  If there were no
 
67
% Show how to linearize a gamma table.  If there were no
69
68
% quantization in the DAC, these values would linearize perfectly.
70
69
% Actually linearization will be affected by the precision of the DACs.
71
70
 
72
 
% Set inversion method.  Method 0 does an exahaustive search of the values
73
 
% from the smooth fit to the data that are in the table.
 
71
% Set inversion method.  See SetGammaMethod for information on available
 
72
% methods.
74
73
defaultGammaMethod = 0;
75
74
gammaMethod = input(sprintf('Enter gamma method [%d]:',defaultGammaMethod));
76
75
if (isempty(gammaMethod))
81
80
% Make the desired linear output, then convert.
82
81
linearValues = ones(3,1)*linspace(0,1,256);
83
82
clutValues = PrimaryToSettings(cal,linearValues);
 
83
predValues = SettingsToPrimary(cal,clutValues);
84
84
 
85
85
% Make a plot of the inverse lookup table.
86
86
figure; clf;
103
103
ylabel('Input value');
104
104
title('Inverse Gamma');
105
105
 
 
106
% Make a plot of the obtained linear values.
 
107
figure; clf;
 
108
subplot(1,3,1); hold on
 
109
plot(linearValues,predValues(1,:)','r');
 
110
axis([0 1 0 1]); axis('square');
 
111
xlabel('Desired value');
 
112
ylabel('Predicted value');
 
113
title('Gamma Correction');
 
114
subplot(1,3,2); hold on
 
115
plot(linearValues,predValues(2,:)','g');
 
116
axis([0 1 0 1]); axis('square');
 
117
xlabel('Desired value');
 
118
ylabel('Predicted value');
 
119
title('Gamma Correction');
 
120
subplot(1,3,3); hold on
 
121
plot(linearValues,predValues(3,:)','b');
 
122
axis([0 1 0 1]); axis('square');
 
123
xlabel('Desired value');
 
124
ylabel('Predicted value');
 
125
title('Gamma Correction');
 
126
 
106
127
%% Color space conversions  - CIE 1931
107
128
% Let's see how to do some standard color conversions
108
129