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