-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathNikonD5100ColorMap.m
83 lines (74 loc) · 2.4 KB
/
NikonD5100ColorMap.m
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
%% Nikon D5100 camera
% Save the Nikon D5100 spectral response curves in a format used by other
% scripts.
%
% ## Usage
% Modify the parameters, the first code section below, then run.
%
% ## Input
%
% The Nikon D5100 spectral sensitivity data were retrieved from
% https://spectralestimation.wordpress.com/data/, and correspond to the
% following publication:
%
% Darrodi, M. M., Finlayson, G., Goodman, T., & Mackiewicz, M. (2015).
% "Reference data set for camera spectral sensitivity estimation."
% Journal of the Optical Society of America A, 32(3), 381-391.
% doi:10.1364/JOSAA.32.000381
%
% ## Output
%
% ### Graphical output
% - A plot of the spectral response functions.
%
% ### Sensor quantum efficiency data
%
% A '.mat' file containing the following variables:
% - 'channel_mode': A Boolean value set to `false` to indicate that the
% data in `sensor_map` represents spectral sensitivities, not colour
% channel mappings
% - 'sensor_map': A 2D array, where `sensor_map(i, j)` is the sensitivity
% of the i-th spectral response function (Red, Green, Blue) to light of
% the j-th wavelength.
% - 'bands': A vector containing the wavelengths corresponding to the
% columns of `sensor_map`.
%
% Additionally, the file contains the values of all parameters in the first
% section of the script below, for reference. (Specifically, those listed
% in `parameters_list`, which should be updated if the set of parameters is
% changed.)
% Bernard Llanos
% Supervised by Dr. Y.H. Yang
% University of Alberta, Department of Computing Science
% File created August 3, 2018
% List of parameters to save with results
parameters_list = {
'data_source',...
'channel_mode'...
};
%% Input data and parameters
data_source = '${FILEPATH}';
% Data represents spectral sensitivities, not colour channel mappings
channel_mode = false;
%% Load the data
qe_table = readtable(data_source);
bands = qe_table{:, 1};
sensor_map = qe_table{:, 2:end};
%% Visualization
figure;
hold on
plot(bands, sensor_map(:, 1), 'r');
plot(bands, sensor_map(:, 2), 'g');
plot(bands, sensor_map(:, 3), 'b');
hold off
xlabel('Wavelength [nm]')
ylabel('Response')
title('Nikon D5100 spectral sensitivity functions')
legend('Red', 'Green', 'Blue')
%% Save to a file
sensor_map = sensor_map.';
save_variables_list = [ parameters_list, {...
'sensor_map',...
'bands'...
} ];
uisave(save_variables_list,'NikonD5100ColorMapData');