|
7 | 7 | figureDir = getpref('ColorTracking','figureSavePath'); |
8 | 8 |
|
9 | 9 | %% Load typical calibration file from the experiment |
10 | | -% whichCalFile = 'ViewSonicG220fb_670.mat'; |
11 | | -whichCalFile = 'ViewSonicG220fb.mat'; |
12 | | -whichCalNumber = 1; |
| 10 | +whichExperiment = 'detection'; |
| 11 | +switch (whichExperiment) |
| 12 | + case 'tracking' |
| 13 | + whichCalFile = 'ViewSonicG220fb.mat'; |
| 14 | + whichCalNumber = 1; |
| 15 | + nDeviceBits = 8; |
| 16 | + whichCones = 'ss2'; |
| 17 | + NOAMBIENT = false; |
| 18 | + case 'detection' |
| 19 | + whichCalFile = 'ViewSonicG220fb_670.mat'; |
| 20 | + whichCalNumber = 1; |
| 21 | + nDeviceBits = 12; |
| 22 | + whichCones = 'asano'; |
| 23 | + NOAMBIENT = true; |
| 24 | +end |
13 | 25 | resourcesDir = getpref('ColorTracking','CalDataFolder'); |
14 | 26 | load(fullfile(resourcesDir,whichCalFile),'cals'); |
15 | 27 | cal = cals{whichCalNumber}; |
16 | 28 |
|
17 | 29 | %% Cone cal object |
18 | 30 | calObjCones = ObjectToHandleCalOrCalStruct(cal); |
19 | 31 |
|
20 | | -% Make this a 12-bit device as far as the calibration file goes. |
21 | | -% |
22 | | -% HARDWARE FOR DETECTION WAS 14-BIT, BUT FOR TRACKING WAS LOWER. |
23 | | -nDeviceBits = 12; |
| 32 | +% Make the bit depth correct as far as the calibration file goes. |
24 | 33 | nDeviceLevels = 2^nDeviceBits; |
25 | 34 | CalibrateFitGamma(calObjCones, nDeviceLevels); |
26 | 35 | nPrimaries = calObjCones.get('nDevices'); |
|
33 | 42 | Scolor = calObjCones.get('S'); |
34 | 43 |
|
35 | 44 | % Zero out ambient? |
36 | | -% [HOW WAS THIS SET FOR THE EXPERIMENT???] |
37 | | -NOAMBIENT = false; |
38 | 45 | if (NOAMBIENT) |
39 | 46 | calObjCones.set('P_ambient',zeros(size(calObjCones.get('P_ambient')))); |
40 | 47 | end |
|
43 | 50 | % what was loaded in the tracking code. In the detection code, |
44 | 51 | % it was ComputeObserverFundamentals with parameters below, which |
45 | 52 | % are not quite T_cones_ss2. |
46 | | -% |
47 | | -% psiParamsStruct.coneParams = DefaultConeParams('cie_asano'); |
48 | | -% psiParamsStruct.coneParams.fieldSizeDegrees = 2; |
49 | | -% psiParamsStruct.coneParams.ageYears = 30; |
50 | | -%T_cones = ComputeObserverFundamentals(psiParamsStruct.coneParams,Scolor); |
51 | | -% [WHICH CONES WERE REALLY USED? SUBJECT AGES WERE 28, 29, and 33] |
52 | | -load T_cones_ss2 |
53 | | -T_cones = SplineCmf(S_cones_ss2,T_cones_ss2,Scolor); |
| 53 | +switch (whichCones) |
| 54 | + case 'asano' |
| 55 | + psiParamsStruct.coneParams = DefaultConeParams('cie_asano'); |
| 56 | + psiParamsStruct.coneParams.fieldSizeDegrees = 2; |
| 57 | + psiParamsStruct.coneParams.ageYears = 30; |
| 58 | + T_cones = ComputeObserverFundamentals(psiParamsStruct.coneParams,Scolor); |
| 59 | + case 'ss2' |
| 60 | + load T_cones_ss2 |
| 61 | + T_cones = SplineCmf(S_cones_ss2,T_cones_ss2,Scolor); |
| 62 | +end |
54 | 63 | SetSensorColorSpace(calObjCones,T_cones,Scolor); |
55 | 64 |
|
56 | 65 | %% XYZ cal object |
|
67 | 76 | % |
68 | 77 | % We report a nominal max contrast which is the contrast that would have been |
69 | 78 | % shown had the 100% contrast Gabor image been in cosine phase. But ours |
70 | | -% were in sin phase. The maximum value of the Gabor was 0.9221. We divide |
| 79 | +% were in sin phase. The maximum value of the Gabor was 0.9221 as we |
| 80 | +% found it by stepping through the tracking code, and 0.9608 as we found |
| 81 | +% it by looking at S.stmLE in the detection code saved data. We divide |
71 | 82 | % our maximum gamut contrasts by this to get the real maximum contrast we |
72 | | -% report. |
73 | | -imageScaleFactor = 0.9221; |
| 83 | +% report. Not sure why there is a difference. |
| 84 | +imageScaleFactor = 0.9221; % 0.9221; 0.9608; |
74 | 85 |
|
75 | 86 | % XYZ |
76 | 87 | USE1931XYZ = true; |
|
102 | 113 | end |
103 | 114 | bgxyY = XYZToxyY(bgXYZ); |
104 | 115 | bgCones = PrimaryToSensor(calObjCones,bgPrimary); |
| 116 | + |
| 117 | +% Print basic info and report on monitor |
| 118 | +fprintf('\nExperiment %s, calibration file %s, calibration number %d, calibration date %s\n', ... |
| 119 | + whichExperiment,whichCalFile,whichCalNumber,calObjXYZ.cal.describe.date); |
| 120 | +fprintf('\nNOAMBIENT = %d, cone option %s\n',NOAMBIENT,whichCones); |
105 | 121 | fprintf('\nBackground x,y = %0.4f, %0.4f\n',bgxyY(1),bgxyY(2)); |
106 | | -fprintf('Background Y = %0.2f cd/m2, ambient %0.3f cd/m2\n\n',bgXYZ(2),ambientXYZ(2)); |
| 122 | +fprintf('Background Y = %0.2f cd/m2, ambient %0.3f cd/m2\n',bgXYZ(2),ambientXYZ(2)); |
| 123 | + |
| 124 | +% Compute monitor primary xyY to try to understand what drifted |
| 125 | +primaryXYZ = PrimaryToSensor(calObjXYZ,[[1 0 0]' [0 1 0]' [0 0 1]']); |
| 126 | +primaryxyY = XYZToxyY(primaryXYZ); |
| 127 | +fprintf('\nRed primary xyY: %0.4f, %0.4f, %0.2f cd/m2\n',primaryxyY(1,1),primaryxyY(2,1),primaryxyY(3,1)); |
| 128 | +fprintf('Green primary xyY: %0.4f, %0.4f, %0.2f cd/m2\n',primaryxyY(1,2),primaryxyY(2,2),primaryxyY(3,2)); |
| 129 | +fprintf('Blue primary xyY: %0.4f, %0.4f, %0.2f cd/m2\n',primaryxyY(1,3),primaryxyY(2,3),primaryxyY(3,3)); |
| 130 | +fprintf('\n'); |
107 | 131 |
|
108 | 132 | %% Max contrast |
109 | 133 | % |
|
0 commit comments