-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paths_evalNatural100DaylightNumLeds.m
More file actions
88 lines (58 loc) · 2.29 KB
/
s_evalNatural100DaylightNumLeds.m
File metadata and controls
88 lines (58 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
% This script reads in the simulated patch data from the Natural 100 test
% chart and performs the spectral estimation using different number of
% LEDs.
%
% Copytight, Henryk Blasinski 2017.
close all;
clear all;
clc;
%%
ledSets = {[1,4,7],...
[1,3,4,7],...
[1,3,4,5,7],...
[1,2,3,4,5,7],...
[1,2,3,4,5,6,7]};
nLedSets = length(ledSets);
alphaVec = logspace(-3,1,10);
nAlpha = length(alphaVec);
fName = fullfile(cmfRootPath,'Results','simNatural100daylight.mat');
load(fName);
%% Estimate the illuminant
% from measurements
channelEstLin = zeros(nTempVec,10*11,3,nCameras,nLedSets,nAlpha);
wghtEst = zeros(nTempVec,nChannels,nCameras,nLedSets,nAlpha);
for a=1:nAlpha
for xx=1:nTempVec
[ spd ] = daylight(wave,tempVec(xx));
% figure;
for cam=1:nCameras
currentMeas = measurement{xx,cam};
for s=1:nLedSets
nLEDs = length(ledSets{s});
currentFlash = flashNorm(:,ledSets{s});
ambient = currentMeas.patch.ambient;
data = currentMeas.patch.led(:,ledSets{s},:);
ambient = ambient/max(ambient(:));
data = data/max(data(:));
[ ambientEst, ambientWghts, ambientPredictions ] = globalAmbientEst( ambient, data, currentFlash, 'alpha', alphaVec(a) );
%{
subplot(2,nLedSets,s);
hold on; grid on; box on;
plot(wave,ambientEst);
xlabel('Wavelength, nm');
title(sprintf('%i LEDs',nLEDs));
subplot(2,nLedSets,s+nLedSets);
hold on; grid on; box on;
plot(squeeze(ambient)',ambientPredictions','.');
xlabel('Simulated');
ylabel('Approximation');
%}
channelEstLin(xx,:,:,cam,s,a) = ambientPredictions';
wghtEst(xx,1:nLEDs,cam,s,a) = ambientWghts;
end
end
end
% Save data
fName = fullfile(cmfRootPath,'Results','uniformApproxDaylight.mat');
save(fName);
end