Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
colorchecker.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2020-2021 Aurélien PIERRE.
4 Copyright (C) 2021 Hubert Kowalski.
5 Copyright (C) 2021 Marco Carrarini.
6 Copyright (C) 2021 Ralf Brown.
7 Copyright (C) 2022 Martin Bařinka.
8 Copyright (C) 2023 Luca Zulberti.
9
10 darktable is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14
15 darktable is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with darktable. If not, see <http://www.gnu.org/licenses/>.
22*/
23
28// types of targets we support
39
40// helper to deal with patch color
42{
43 const char *name; // mnemonic name for the patch
44 dt_aligned_pixel_t Lab; // reference color in CIE Lab
45
46 // (x, y) position of the patch center, relatively to the guides (white dots)
47 // in ratio of the grid dimension along that axis
48 struct {
49 float x;
50 float y;
51 };
53
54typedef struct dt_color_checker_t
55{
56 const char *name;
57 const char *author;
58 const char *date;
59 const char *manufacturer;
61
62 float ratio; // format ratio of the chart, guide to guide (white dots)
63 float radius; // radius of a patch in ratio of the checker diagonal
64 size_t patches; // number of patches in target
65 size_t size[2]; // dimension along x, y axes
66 size_t middle_grey; // index of the closest patch to 20% neutral grey
67 size_t white; // index of the closest patch to pure white
68 size_t black; // index of the closest patch to pure black
69 dt_color_checker_patch values[]; // array of colors
71
72
73dt_color_checker_t xrite_24_2000 = { .name = "Xrite ColorChecker 24 before 2014",
74 .author = "X-Rite",
75 .date = "3/27/2000",
76 .manufacturer = "X-Rite/Gretag Macbeth",
78 .radius = 0.055f,
79 .ratio = 2.f / 3.f,
80 .patches = 24,
81 .size = { 4, 6 },
82 .middle_grey = 21,
83 .white = 18,
84 .black = 23,
85 .values = {
86 { "A1", { 37.986, 13.555, 14.059 }, { 0.087, 0.125}},
87 { "A2", { 65.711, 18.13, 17.81 }, { 0.250, 0.125}},
88 { "A3", { 49.927, -04.88, -21.905 }, { 0.417, 0.125}},
89 { "A4", { 43.139, -13.095, 21.905 }, { 0.584, 0.125}},
90 { "A5", { 55.112, 08.844, -25.399 }, { 0.751, 0.125}},
91 { "A6", { 70.719, -33.397, -0.199 }, { 0.918, 0.125}},
92 { "B1", { 62.661, 36.067, 57.096 }, { 0.087, 0.375}},
93 { "B2", { 40.02, 10.41, -45.964 }, { 0.250, 0.375}},
94 { "B3", { 51.124, 48.239, 16.248 }, { 0.417, 0.375}},
95 { "B4", { 30.325, 22.976, -21.587 }, { 0.584, 0.375}},
96 { "B5", { 72.532, -23.709, 57.255 }, { 0.751, 0.375}},
97 { "B6", { 71.941, 19.363, 67.857 }, { 0.918, 0.375}},
98 { "C1", { 28.778, 14.179, -50.297 }, { 0.087, 0.625}},
99 { "C2", { 55.261, -38.342, 31.37 }, { 0.250, 0.625}},
100 { "C3", { 42.101, 53.378, 28.19 }, { 0.417, 0.625}},
101 { "C4", { 81.733, 04.039, 79.819 }, { 0.584, 0.625}},
102 { "C5", { 51.935, 49.986, -14.574 }, { 0.751, 0.625}},
103 { "C6", { 51.038, -28.631, -28.638 }, { 0.918, 0.625}},
104 { "D1", { 96.539, -0.425, 1.186 }, { 0.087, 0.875}},
105 { "D2", { 81.257, -0.638, -0.335 }, { 0.250, 0.875}},
106 { "D3", { 66.766, -0.734, -0.504 }, { 0.417, 0.875}},
107 { "D4", { 50.867, -0.153, -0.27 }, { 0.584, 0.875}},
108 { "D5", { 35.656, -0.421, -1.231 }, { 0.751, 0.875}},
109 { "D6", { 20.461, -0.079, -0.973 }, { 0.918, 0.875}} } };
110
111
112dt_color_checker_t xrite_24_2014 = { .name = "Xrite ColorChecker 24 after 2014",
113 .author = "X-Rite",
114 .date = "3/28/2015",
115 .manufacturer = "X-Rite/Gretag Macbeth",
117 .radius = 0.055f,
118 .ratio = 2.f / 3.f,
119 .patches = 24,
120 .size = { 4, 6 },
121 .middle_grey = 21,
122 .white = 18,
123 .black = 23,
124 .values = {
125 { "A1", { 37.54, 14.37, 14.92 }, { 0.087, 0.125}},
126 { "A2", { 64.66, 19.27, 17.50 }, { 0.250, 0.125}},
127 { "A3", { 49.32, -03.82, -22.54 }, { 0.417, 0.125}},
128 { "A4", { 43.46, -12.74, 22.72 }, { 0.584, 0.125}},
129 { "A5", { 54.94, 09.61, -24.79 }, { 0.751, 0.125}},
130 { "A6", { 70.48, -32.26, -00.37 }, { 0.918, 0.125}},
131 { "B1", { 62.73, 35.83, 56.50 }, { 0.087, 0.375}},
132 { "B2", { 39.43, 10.75, -45.17 }, { 0.250, 0.375}},
133 { "B3", { 50.57, 48.64, 16.67 }, { 0.417, 0.375}},
134 { "B4", { 30.10, 22.54, -20.87 }, { 0.584, 0.375}},
135 { "B5", { 71.77, -24.13, 58.19 }, { 0.751, 0.375}},
136 { "B6", { 71.51, 18.24, 67.37 }, { 0.918, 0.375}},
137 { "C1", { 28.37, 15.42, -49.80 }, { 0.087, 0.625}},
138 { "C2", { 54.38, -39.72, 32.27 }, { 0.250, 0.625}},
139 { "C3", { 42.43, 51.05, 28.62 }, { 0.417, 0.625}},
140 { "C4", { 81.80, 02.67, 80.41 }, { 0.584, 0.625}},
141 { "C5", { 50.63, 51.28, -14.12 }, { 0.751, 0.625}},
142 { "C6", { 49.57, -29.71, -28.32 }, { 0.918, 0.625}},
143 { "D1", { 95.19, -01.03, 02.93 }, { 0.087, 0.875}},
144 { "D2", { 81.29, -00.57, 00.44 }, { 0.250, 0.875}},
145 { "D3", { 66.89, -00.75, -00.06 }, { 0.417, 0.875}},
146 { "D4", { 50.76, -00.13, 00.14 }, { 0.584, 0.875}},
147 { "D5", { 35.63, -00.46, -00.48 }, { 0.751, 0.875}},
148 { "D6", { 20.64, 00.07, -00.46 }, { 0.918, 0.875}} } };
149
150
151// dimensions between reference dots : 197 mm width x 135 mm height
152// patch width : 26x26 mm
153// outer gutter : 8 mm
154// internal gutters (gap between patches) : 5 mm
155dt_color_checker_t spyder_24 = { .name = "Datacolor SpyderCheckr 24 before 2018",
156 .author = "Aur\303\251lien PIERRE",
157 .date = "dec, 9 2016",
158 .manufacturer = "DataColor",
160 .ratio = 2.f / 3.f,
161 .radius = 0.035,
162 .patches = 24,
163 .size = { 4, 6 },
164 .middle_grey = 03,
165 .white = 00,
166 .black = 05,
167 .values = { { "A1", { 96.04, 2.16, 2.60 }, { 0.107, 0.844 } },
168 { "A2", { 80.44, 1.17, 2.05 }, { 0.264, 0.844 } },
169 { "A3", { 65.52, 0.69, 1.86 }, { 0.421, 0.844 } },
170 { "A4", { 49.62, 0.58, 1.56 }, { 0.579, 0.844 } },
171 { "A5", { 33.55, 0.35, 1.40 }, { 0.736, 0.844 } },
172 { "A6", { 16.91, 1.43, -0.81 }, { 0.893, 0.844 } },
173 { "B1", { 47.12, -32.50, -28.75 }, { 0.107, 0.615 } },
174 { "B2", { 50.49, 53.45, -13.55 }, { 0.264, 0.615 } },
175 { "B3", { 83.61, 3.36, 87.02 }, { 0.421, 0.615 } },
176 { "B4", { 41.05, 60.75, 31.17 }, { 0.579, 0.615 } },
177 { "B5", { 54.14, -40.80, 34.75 }, { 0.736, 0.615 } },
178 { "B6", { 24.75, 13.78, -49.48 }, { 0.893, 0.615 } },
179 { "C1", { 60.94, 38.21, 61.31 }, { 0.107, 0.385 } },
180 { "C2", { 37.80, 7.30, -43.04 }, { 0.264, 0.385 } },
181 { "C3", { 49.81, 48.50, 15.76 }, { 0.421, 0.385 } },
182 { "C4", { 28.88, 19.36, -24.48 }, { 0.579, 0.385 } },
183 { "C5", { 72.45, -23.60, 60.47 }, { 0.736, 0.385 } },
184 { "C6", { 71.65, 23.74, 72.28 }, { 0.893, 0.385 } },
185 { "D1", { 70.19, -31.90, 1.98 }, { 0.107, 0.155 } },
186 { "D2", { 54.38, 8.84, -25.71 }, { 0.264, 0.155 } },
187 { "D3", { 42.03, -15.80, 22.93 }, { 0.421, 0.155 } },
188 { "D4", { 48.82, -5.11, -23.08 }, { 0.579, 0.155 } },
189 { "D5", { 65.10, 18.14, 18.68 }, { 0.736, 0.155 } },
190 { "D6", { 36.13, 14.15, 15.78 }, { 0.893, 0.155 } } } };
191
192
193// dimensions between reference dots : 197 mm width x 135 mm height
194// patch width : 26x26 mm
195// outer gutter : 8 mm
196// internal gutters (gap between patches) : 5 mm
197dt_color_checker_t spyder_24_v2 = { .name = "Datacolor SpyderCheckr 24 after 2018",
198 .author = "Aur\303\251lien PIERRE",
199 .date = "dec, 9 2016",
200 .manufacturer = "DataColor",
202 .ratio = 2.f / 3.f,
203 .radius = 0.035,
204 .patches = 24,
205 .size = { 4, 6 },
206 .middle_grey = 03,
207 .white = 00,
208 .black = 05,
209 .values = { { "A1", { 96.04, 2.16, 2.60 }, { 0.107, 0.844 } },
210 { "A2", { 80.44, 1.17, 2.05 }, { 0.264, 0.844 } },
211 { "A3", { 65.52, 0.69, 1.86 }, { 0.421, 0.844 } },
212 { "A4", { 49.62, 0.58, 1.56 }, { 0.579, 0.844 } },
213 { "A5", { 33.55, 0.35, 1.40 }, { 0.736, 0.844 } },
214 { "A6", { 16.91, 1.43, -0.81 }, { 0.893, 0.844 } },
215 { "B1", { 47.12, -32.50, -28.75 }, { 0.107, 0.615 } },
216 { "B2", { 50.49, 53.45, -13.55 }, { 0.264, 0.615 } },
217 { "B3", { 83.61, 3.36, 87.02 }, { 0.421, 0.615 } },
218 { "B4", { 41.05, 60.75, 31.17 }, { 0.579, 0.615 } },
219 { "B5", { 54.14, -40.80, 34.75 }, { 0.736, 0.615 } },
220 { "B6", { 24.75, 13.78, -49.48 }, { 0.893, 0.615 } },
221 { "C1", { 60.94, 38.21, 61.31 }, { 0.107, 0.385 } },
222 { "C2", { 37.80, 7.30, -43.04 }, { 0.264, 0.385 } },
223 { "C3", { 49.81, 48.50, 15.76 }, { 0.421, 0.385 } },
224 { "C4", { 28.88, 19.36, -24.48 }, { 0.579, 0.385 } },
225 { "C5", { 72.45, -23.57, 60.47 }, { 0.736, 0.385 } },
226 { "C6", { 71.65, 23.74, 72.28 }, { 0.893, 0.385 } },
227 { "D1", { 70.19, -31.85, 1.98 }, { 0.107, 0.155 } },
228 { "D2", { 54.38, 8.84, -25.71 }, { 0.264, 0.155 } },
229 { "D3", { 42.03, -15.78, 22.93 }, { 0.421, 0.155 } },
230 { "D4", { 48.82, -5.11, -23.08 }, { 0.579, 0.155 } },
231 { "D5", { 65.10, 18.14, 18.68 }, { 0.736, 0.155 } },
232 { "D6", { 36.13, 14.15, 15.78 }, { 0.893, 0.155 } } } };
233
234
235// dimensions between reference dots : 297 mm width x 197 mm height
236// patch width : 26x26 mm
237// outer gutter : 8 mm
238// internal gutters (gap between patches) : 5 mm
239dt_color_checker_t spyder_48 = { .name = "Datacolor SpyderCheckr 48 before 2018",
240 .author = "Aur\303\251lien PIERRE",
241 .date = "dec, 9 2016",
242 .manufacturer = "DataColor",
244 .ratio = 2.f / 3.f,
245 .radius = 0.035,
246 .patches = 48,
247 .size = { 8, 6 },
248 .middle_grey = 24,
249 .white = 21,
250 .black = 29,
251 .values = { { "A1", { 61.35, 34.81, 18.38 }, { 0.071, 0.107 } },
252 { "A2", { 75.50 , 5.84, 50.42 }, { 0.071, 0.264 } },
253 { "A3", { 66.82, -25.1, 23.47 }, { 0.071, 0.421 } },
254 { "A4", { 60.53, -22.6, -20.40 }, { 0.071, 0.579 } },
255 { "A5", { 59.66, -2.03, -28.46 }, { 0.071, 0.736 } },
256 { "A6", { 59.15, 30.83, -5.72 }, { 0.071, 0.893 } },
257 { "B1", { 82.68, 5.03, 3.02 }, { 0.175, 0.107 } },
258 { "B2", { 82.25, -2.42, 3.78 }, { 0.175, 0.264 } },
259 { "B3", { 82.29, 2.20, -2.04 }, { 0.175, 0.421 } },
260 { "B4", { 24.89, 4.43, 0.78 }, { 0.175, 0.579 } },
261 { "B5", { 25.16, -3.88, 2.13 }, { 0.175, 0.736 } },
262 { "B6", { 26.13, 2.61, -5.03 }, { 0.175, 0.893 } },
263 { "C1", { 85.42, 9.41, 14.49 }, { 0.279, 0.107 } },
264 { "C2", { 74.28, 9.05, 27.21 }, { 0.279, 0.264 } },
265 { "C3", { 64.57, 12.39, 37.24 }, { 0.279, 0.421 } },
266 { "C4", { 44.49, 17.23, 26.24 }, { 0.279, 0.579 } },
267 { "C5", { 25.29, 7.95, 8.87 }, { 0.279, 0.736 } },
268 { "C6", { 22.67, 2.11, -1.10 }, { 0.279, 0.893 } },
269 { "D1", { 92.72, 1.89, 2.76 }, { 0.384, 0.107 } },
270 { "D2", { 88.85, 1.59, 2.27 }, { 0.384, 0.264 } },
271 { "D3", { 73.42, 0.99, 1.89 }, { 0.384, 0.421 } },
272 { "D4", { 57.15, 0.57, 1.19 }, { 0.384, 0.579 } },
273 { "D5", { 41.57, 0.24, 1.45 }, { 0.384, 0.736 } },
274 { "D6", { 25.65, 1.24, 0.05 }, { 0.384, 0.893 } },
275 { "E1", { 96.04, 2.16, 2.60 }, { 0.616, 0.107 } },
276 { "E2", { 80.44, 1.17, 2.05 }, { 0.616, 0.264 } },
277 { "E3", { 65.52, 0.69, 1.86 }, { 0.616, 0.421 } },
278 { "E4", { 49.62, 0.58, 1.56 }, { 0.616, 0.579 } },
279 { "E5", { 33.55, 0.35, 1.40 }, { 0.616, 0.736 } },
280 { "E6", { 16.91, 1.43, -0.81 }, { 0.616, 0.893 } },
281 { "F1", { 47.12, -32.50, -28.75 }, { 0.721, 0.107 } },
282 { "F2", { 50.49, 53.45, -13.55 }, { 0.721, 0.264 } },
283 { "F3", { 83.61, 3.36, 87.02 }, { 0.721, 0.421 } },
284 { "F4", { 41.05, 60.75, 31.17 }, { 0.721, 0.579 } },
285 { "F5", { 54.14, -40.80, 34.75 }, { 0.721, 0.736 } },
286 { "F6", { 24.75, 13.78, -49.48 }, { 0.721, 0.893 } },
287 { "G1", { 60.94, 38.21, 61.31 }, { 0.825, 0.107 } },
288 { "G2", { 37.80, 7.30, -43.04 }, { 0.825, 0.264 } },
289 { "G3", { 49.81, 48.50, 15.76 }, { 0.825, 0.421 } },
290 { "G4", { 28.88, 19.36, -24.48 }, { 0.825, 0.579 } },
291 { "G5", { 72.45, -23.60, 60.47 }, { 0.825, 0.736 } },
292 { "G6", { 71.65, 23.74, 72.28 }, { 0.825, 0.893 } },
293 { "H1", { 70.19, -31.90, 1.98 }, { 0.929, 0.107 } },
294 { "H2", { 54.38, 8.84, -25.71 }, { 0.929, 0.264 } },
295 { "H3", { 42.03, -15.80, 22.93 }, { 0.929, 0.421 } },
296 { "H4", { 48.82, -5.11, -23.08 }, { 0.929, 0.579 } },
297 { "H5", { 65.10, 18.14, 18.68 }, { 0.929, 0.736 } },
298 { "H6", { 36.13, 14.15, 15.78 }, { 0.929, 0.893 } } } };
299
300
301// dimensions between reference dots : 297 mm width x 197 mm height
302// patch width : 26x26 mm
303// outer gutter : 8 mm
304// internal gutters (gap between patches) : 5 mm
305dt_color_checker_t spyder_48_v2 = { .name = "Datacolor SpyderCheckr 48 after 2018",
306 .author = "Aur\303\251lien PIERRE",
307 .date = "dec, 9 2016",
308 .manufacturer = "DataColor",
310 .ratio = 2.f / 3.f,
311 .radius = 0.035,
312 .patches = 48,
313 .size = { 8, 6 },
314 .middle_grey = 24,
315 .white = 21,
316 .black = 29,
317 .values = { { "A1", { 61.35, 34.81, 18.38 }, { 0.071, 0.107 } },
318 { "A2", { 75.50 , 5.84, 50.42 }, { 0.071, 0.264 } },
319 { "A3", { 66.82, -25.1, 23.47 }, { 0.071, 0.421 } },
320 { "A4", { 60.53, -22.62, -20.40 }, { 0.071, 0.579 } },
321 { "A5", { 59.66, -2.03, -28.46 }, { 0.071, 0.736 } },
322 { "A6", { 59.15, 30.83, -5.72 }, { 0.071, 0.893 } },
323 { "B1", { 82.68, 5.03, 3.02 }, { 0.175, 0.107 } },
324 { "B2", { 82.25, -2.42, 3.78 }, { 0.175, 0.264 } },
325 { "B3", { 82.29, 2.20, -2.04 }, { 0.175, 0.421 } },
326 { "B4", { 24.89, 4.43, 0.78 }, { 0.175, 0.579 } },
327 { "B5", { 25.16, -3.88, 2.13 }, { 0.175, 0.736 } },
328 { "B6", { 26.13, 2.61, -5.03 }, { 0.175, 0.893 } },
329 { "C1", { 85.42, 9.41, 14.49 }, { 0.279, 0.107 } },
330 { "C2", { 74.28, 9.05, 27.21 }, { 0.279, 0.264 } },
331 { "C3", { 64.57, 12.39, 37.24 }, { 0.279, 0.421 } },
332 { "C4", { 44.49, 17.23, 26.24 }, { 0.279, 0.579 } },
333 { "C5", { 25.29, 7.95, 8.87 }, { 0.279, 0.736 } },
334 { "C6", { 22.67, 2.11, -1.10 }, { 0.279, 0.893 } },
335 { "D1", { 92.72, 1.89, 2.76 }, { 0.384, 0.107 } },
336 { "D2", { 88.85, 1.59, 2.27 }, { 0.384, 0.264 } },
337 { "D3", { 73.42, 0.99, 1.89 }, { 0.384, 0.421 } },
338 { "D4", { 57.15, 0.57, 1.19 }, { 0.384, 0.579 } },
339 { "D5", { 41.57, 0.24, 1.45 }, { 0.384, 0.736 } },
340 { "D6", { 25.65, 1.24, 0.05 }, { 0.384, 0.893 } },
341 { "E1", { 96.04, 2.16, 2.60 }, { 0.616, 0.107 } },
342 { "E2", { 80.44, 1.17, 2.05 }, { 0.616, 0.264 } },
343 { "E3", { 65.52, 0.69, 1.86 }, { 0.616, 0.421 } },
344 { "E4", { 49.62, 0.58, 1.56 }, { 0.616, 0.579 } },
345 { "E5", { 33.55, 0.35, 1.40 }, { 0.616, 0.736 } },
346 { "E6", { 16.91, 1.43, -0.81 }, { 0.616, 0.893 } },
347 { "F1", { 47.12, -32.50, -28.75 }, { 0.721, 0.107 } },
348 { "F2", { 50.49, 53.45, -13.55 }, { 0.721, 0.264 } },
349 { "F3", { 83.61, 3.36, 87.02 }, { 0.721, 0.421 } },
350 { "F4", { 41.05, 60.75, 31.17 }, { 0.721, 0.579 } },
351 { "F5", { 54.14, -40.80, 34.75 }, { 0.721, 0.736 } },
352 { "F6", { 24.75, 13.78, -49.48 }, { 0.721, 0.893 } },
353 { "G1", { 60.94, 38.21, 61.31 }, { 0.825, 0.107 } },
354 { "G2", { 37.80, 7.30, -43.04 }, { 0.825, 0.264 } },
355 { "G3", { 49.81, 48.50, 15.76 }, { 0.825, 0.421 } },
356 { "G4", { 28.88, 19.36, -24.48 }, { 0.825, 0.579 } },
357 { "G5", { 72.45, -23.57, 60.47 }, { 0.825, 0.736 } },
358 { "G6", { 71.65, 23.74, 72.28 }, { 0.825, 0.893 } },
359 { "H1", { 70.19, -31.85, 1.98 }, { 0.929, 0.107 } },
360 { "H2", { 54.38, 8.84, -25.71 }, { 0.929, 0.264 } },
361 { "H3", { 42.03, -15.78, 22.93 }, { 0.929, 0.421 } },
362 { "H4", { 48.82, -5.11, -23.08 }, { 0.929, 0.579 } },
363 { "H5", { 65.10, 18.14, 18.68 }, { 0.929, 0.736 } },
364 { "H6", { 36.13, 14.15, 15.78 }, { 0.929, 0.893 } } } };
365
366
368{
369 switch(target_type)
370 {
372 return &xrite_24_2000;
373
375 return &xrite_24_2014;
376
378 return &spyder_24;
379
381 return &spyder_24_v2;
382
384 return &spyder_48;
385
387 return &spyder_48_v2;
388
390 return &xrite_24_2014;
391 }
392
393 return &xrite_24_2014;
394}
395
400// get a patch index in the list of values from the coordinates of the patch in the checker array
401static inline size_t dt_color_checker_get_index(const dt_color_checker_t *const target_checker, const size_t coordinates[2])
402{
403 // patches are stored column-major
404 const size_t height = target_checker->size[1];
405 return CLAMP(height * coordinates[0] + coordinates[1], 0, target_checker->patches - 1);
406}
407
408// get a a patch coordinates of in the checker array from the patch index in the list of values
409static inline void dt_color_checker_get_coordinates(const dt_color_checker_t *const target_checker, size_t *coordinates, const size_t index)
410{
411 // patches are stored column-major
412 const size_t idx = CLAMP(index, 0, target_checker->patches - 1);
413 const size_t height = target_checker->size[1];
414 const size_t num_col = idx / height;
415 const size_t num_lin = idx - num_col * height;
416 coordinates[0] = CLAMP(num_col, 0, target_checker->size[0] - 1);
417 coordinates[1] = CLAMP(num_lin, 0, target_checker->size[1] - 1);
418}
419
420// find a patch matching a name
421static inline const dt_color_checker_patch* dt_color_checker_get_patch_by_name(const dt_color_checker_t *const target_checker,
422 const char *name, size_t *index)
423{
424 size_t idx = -1;
425 const dt_color_checker_patch *patch = NULL;
426
427 for(size_t k = 0; k < target_checker->patches; k++)
428 if(strcmp(name, target_checker->values[k].name) == 0)
429 {
430 idx = k;
431 patch = &target_checker->values[k];
432 break;
433 }
434
435 if(patch == NULL) fprintf(stderr, "No patch matching name `%s` was found in %s\n", name, target_checker->name);
436
437 if(index ) *index = idx;
438 return patch;
439}
440// clang-format off
441// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
442// vim: shiftwidth=2 expandtab tabstop=2 cindent
443// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
444// clang-format on
int height
Definition bilateral.h:1
dt_color_checker_targets
Definition colorchecker.h:30
@ COLOR_CHECKER_SPYDER_48
Definition colorchecker.h:35
@ COLOR_CHECKER_XRITE_24_2000
Definition colorchecker.h:31
@ COLOR_CHECKER_XRITE_24_2014
Definition colorchecker.h:32
@ COLOR_CHECKER_LAST
Definition colorchecker.h:37
@ COLOR_CHECKER_SPYDER_24_V2
Definition colorchecker.h:34
@ COLOR_CHECKER_SPYDER_24
Definition colorchecker.h:33
@ COLOR_CHECKER_SPYDER_48_V2
Definition colorchecker.h:36
static size_t dt_color_checker_get_index(const dt_color_checker_t *const target_checker, const size_t coordinates[2])
Definition colorchecker.h:401
dt_color_checker_t spyder_24
Definition colorchecker.h:155
static const dt_color_checker_patch * dt_color_checker_get_patch_by_name(const dt_color_checker_t *const target_checker, const char *name, size_t *index)
Definition colorchecker.h:421
dt_color_checker_t spyder_48
Definition colorchecker.h:239
dt_color_checker_t spyder_48_v2
Definition colorchecker.h:305
dt_color_checker_t spyder_24_v2
Definition colorchecker.h:197
static void dt_color_checker_get_coordinates(const dt_color_checker_t *const target_checker, size_t *coordinates, const size_t index)
Definition colorchecker.h:409
dt_color_checker_t * dt_get_color_checker(const dt_color_checker_targets target_type)
Definition colorchecker.h:367
dt_color_checker_t xrite_24_2014
Definition colorchecker.h:112
dt_color_checker_t xrite_24_2000
Definition colorchecker.h:73
char * name
Definition common/metadata.c:61
Definition colorchecker.h:42
float x
Definition colorchecker.h:49
dt_aligned_pixel_t Lab
Definition colorchecker.h:44
float y
Definition colorchecker.h:50
const char * name
Definition colorchecker.h:43
Definition colorchecker.h:55
const char * date
Definition colorchecker.h:58
const char * name
Definition colorchecker.h:56
dt_color_checker_targets type
Definition colorchecker.h:60
const char * author
Definition colorchecker.h:57
dt_color_checker_patch values[]
Definition colorchecker.h:69
size_t white
Definition colorchecker.h:67
float ratio
Definition colorchecker.h:62
size_t size[2]
Definition colorchecker.h:65
size_t middle_grey
Definition colorchecker.h:66
float radius
Definition colorchecker.h:63
size_t black
Definition colorchecker.h:68
const char * manufacturer
Definition colorchecker.h:59
size_t patches
Definition colorchecker.h:64