11 namespace depth_to_rgb_calibration {
19 const calib & yuy_intrin_extrin
22 auto r = yuy_intrin_extrin.
rot.
rot;
24 auto d = yuy_intrin_extrin.
coeffs;
30 auto sin_a = (double)sin( rot_angles.
alpha );
31 auto sin_b = (double)sin( rot_angles.
beta );
32 auto sin_g = (double)sin( rot_angles.
gamma );
34 auto cos_a = (double)cos( rot_angles.
alpha );
35 auto cos_b = (double)cos( rot_angles.
beta );
36 auto cos_g = (double)cos( rot_angles.
gamma );
37 auto x1 = (double)xy.
x;
38 auto y1 = (
double)xy.
y;
43 auto x2_y2 = xy2 * xy2;
50 auto exp1 =
z * (0 * sin_b + 1 * cos_a*cos_b - 0 * cos_b*sin_a)
51 +
x * (0 * (cos_a*sin_g + cos_g * sin_a*sin_b)
52 + 1 * (sin_a*sin_g - cos_a * cos_g*sin_b)
54 +
y * (0 * (cos_a*cos_g - sin_a * sin_b*sin_g)
55 + 1 * (cos_g*sin_a + cos_a * sin_b*sin_g)
57 + 1 * (0 * t[0] + 0 * t[1] + 1 * t[2]);
59 auto res = (((
x*(0 * (sin_a*sin_g - cos_a * cos_g*sin_b)
60 - 1 * (cos_a*sin_g + cos_g * sin_a*sin_b)
61 ) +
y * (0 * (cos_g*sin_a + cos_a * sin_b*sin_g)
62 - 1 * (cos_a*cos_g - sin_a * sin_b*sin_g)
63 ) +
z * (0 * cos_a*cos_b + 1 * cos_b*sin_a)
64 )*(
z*(
fx*sin_b +
ppx * cos_a*cos_b - 0 * cos_b*sin_a)
65 +
x * (0 * (cos_a*sin_g + cos_g * sin_a*sin_b)
66 +
ppx * (sin_a*sin_g - cos_a * cos_g*sin_b)
68 +
y * (0 * (cos_a*cos_g - sin_a * sin_b*sin_g)
69 +
ppx * (cos_g*sin_a + cos_a * sin_b*sin_g)
71 + 1 * (
fx*t[0] + 0 * t[1] +
ppx * t[2])
72 ) - (
x*(0 * (sin_a*sin_g - cos_a * cos_g*sin_b)
73 -
ppx * (cos_a*sin_g + cos_g * sin_a*sin_b)
74 ) +
y * (0 * (cos_g*sin_a + cos_a * sin_b*sin_g)
75 -
ppx * (cos_a*cos_g - sin_a * sin_b*sin_g)
76 ) +
z * (0 * cos_a*cos_b +
ppx * cos_b*sin_a)
77 )*(
z*(0 * sin_b + 1 * cos_a*cos_b - 0 * cos_b*sin_a)
78 +
x * (0 * (cos_a*sin_g + cos_g * sin_a*sin_b)
79 + 1 * (sin_a*sin_g - cos_a * cos_g*sin_b)
81 +
y * (0 * (cos_a*cos_g - sin_a * sin_b*sin_g)
82 + 1 * (cos_g*sin_a + cos_a * sin_b*sin_g)
84 + 1 * (0 * t[0] + 0 * t[1] + 1 * t[2])
86 *(rc + 6 *
d[3] * x1 + 2 *
d[2] * y1 + x1 * (2 *
d[0] * x1 + 4 *
d[1] * x1*(xy2)+6 *
d[4] * x1*x2_y2))
87 ) / (exp1*exp1) + (
fx*((
x*(0 * (sin_a*sin_g - cos_a * cos_g*sin_b)
88 - 1 * (cos_a*sin_g + cos_g * sin_a*sin_b)
89 ) +
y * (0 * (cos_g*sin_a + cos_a * sin_b*sin_g)
90 - 1 * (cos_a*cos_g - sin_a * sin_b*sin_g)
91 ) +
z * (0 * cos_a*cos_b + 1 * cos_b*sin_a)
92 )*(
z*(0 * sin_b +
ppy * cos_a*cos_b -
fy * cos_b*sin_a)
93 +
x * (
fy*(cos_a*sin_g + cos_g * sin_a*sin_b)
94 +
ppy * (sin_a*sin_g - cos_a * cos_g*sin_b)
96 +
y * (
fy*(cos_a*cos_g - sin_a * sin_b*sin_g)
97 +
ppy * (cos_g*sin_a + cos_a * sin_b*sin_g)
99 + 1 * (0 * t[0] +
fy * t[1] +
ppy * t[2])
100 ) - (
x*(
fy*(sin_a*sin_g - cos_a * cos_g*sin_b)
101 -
ppy * (cos_a*sin_g + cos_g * sin_a*sin_b)
102 ) +
y * (
fy*(cos_g*sin_a + cos_a * sin_b*sin_g)
103 -
ppy * (cos_a*cos_g - sin_a * sin_b*sin_g)
104 ) +
z * (
fy*cos_a*cos_b +
ppy * cos_b*sin_a)
105 )*(
z*(0 * sin_b + 1 * cos_a*cos_b - 0 * cos_b*sin_a)
106 +
x * (0 * (cos_a*sin_g + cos_g * sin_a*sin_b)
107 + 1 * (sin_a*sin_g - cos_a * cos_g*sin_b)
109 +
y * (0 * (cos_a*cos_g - sin_a * sin_b*sin_g)
110 + 1 * (cos_g*sin_a + cos_a * sin_b*sin_g)
112 + 1 * (0 * t[0] + 0 * t[1] + 1 * t[2])
114 *(2 *
d[2] * x1 + 2 *
d[3] * y1 + x1 * (2 *
d[0] * y1 + 4 *
d[1] * y1*(xy2)+6 *
d[4] * y1*x2_y2))
115 ) / (
fy*(exp1*exp1));
124 const calib & yuy_intrin_extrin
127 auto r = yuy_intrin_extrin.
rot.
rot;
129 auto d = yuy_intrin_extrin.
coeffs;
135 auto sin_a = sin( rot_angles.
alpha );
136 auto sin_b = sin( rot_angles.
beta );
137 auto sin_g = sin( rot_angles.
gamma );
139 auto cos_a = cos( rot_angles.
alpha );
140 auto cos_b = cos( rot_angles.
beta );
141 auto cos_g = cos( rot_angles.
gamma );
142 auto x1 = (double)xy.
x;
143 auto y1 = (
double)xy.
y;
148 auto x2_y2 = xy2 * xy2;
150 auto x = (double)v.
x;
151 auto y = (
double)v.
y;
152 auto z = (double)v.
z;
154 auto exp1 =
z * (cos_a*cos_b) +
155 x * ((sin_a*sin_g - cos_a * cos_g*sin_b))
156 +
y * ((cos_g*sin_a + cos_a * sin_b*sin_g))
159 auto res = -(((
z*(0 * cos_b - 1 * cos_a*sin_b + 0 * sin_a*sin_b)
160 -
x * (0 * cos_g*sin_b + 1 * cos_a*cos_b*cos_g - 0 * cos_b*cos_g*sin_a)
161 +
y * (0 * sin_b*sin_g + 1 * cos_a*cos_b*sin_g - 0 * cos_b*sin_a*sin_g)
162 )*(
z*(
fx*sin_b +
ppx * cos_a*cos_b - 0 * cos_b*sin_a)
163 +
x * (0 * (cos_a*sin_g + cos_g * sin_a*sin_b)
164 +
ppx * (sin_a*sin_g - cos_a * cos_g*sin_b)
166 +
y * (0 * (cos_a*cos_g - sin_a * sin_b*sin_g)
167 +
ppx * (cos_g*sin_a + cos_a * sin_b*sin_g)
169 + 1 * (
fx*t[0] + 0 * t[1] +
ppx * t[2])
170 ) - (
z*(
fx*cos_b -
ppx * cos_a*sin_b + 0 * sin_a*sin_b)
171 -
x * (
fx*cos_g*sin_b +
ppx * cos_a*cos_b*cos_g - 0 * cos_b*cos_g*sin_a)
172 +
y * (
fx*sin_b*sin_g +
ppx * cos_a*cos_b*sin_g - 0 * cos_b*sin_a*sin_g)
173 )*(
z*(0 * sin_b + 1 * cos_a*cos_b - 0 * cos_b*sin_a)
174 +
x * (0 * (cos_a*sin_g + cos_g * sin_a*sin_b)
175 + 1 * (sin_a*sin_g - cos_a * cos_g*sin_b)
177 +
y * (0 * (cos_a*cos_g - sin_a * sin_b*sin_g)
178 + 1 * (cos_g*sin_a + cos_a * sin_b*sin_g)
180 + 1 * (0 * t[0] + 0 * t[1] + 1 * t[2])))
181 *(rc + 6 *
d[3] * x1 + 2 *
d[2] * y1 + x1 * (2 *
d[0] * x1 + 4 *
d[1] * x1*(xy2)+6 *
d[4] * x1*x2_y2))
182 ) / (exp1* exp1) - (
fx*((
z*(0 * cos_b - 1 * cos_a*sin_b + 0 * sin_a*sin_b)
183 -
x * (0 * cos_g*sin_b + 1 * cos_a*cos_b*cos_g - 0 * cos_b*cos_g*sin_a)
184 +
y * (0 * sin_b*sin_g + 1 * cos_a*cos_b*sin_g - 0 * cos_b*sin_a*sin_g)
185 )*(
z*(0 * sin_b +
ppy * cos_a*cos_b -
fy * cos_b*sin_a)
186 +
x * (
fy*(cos_a*sin_g + cos_g * sin_a*sin_b)
187 +
ppy * (sin_a*sin_g - cos_a * cos_g*sin_b)
189 +
y * (
fy*(cos_a*cos_g - sin_a * sin_b*sin_g)
190 +
ppy * (cos_g*sin_a + cos_a * sin_b*sin_g)
192 + 1 * (0 * t[0] +
fy * t[1] +
ppy * t[2])
193 ) - (
z*(0 * cos_b -
ppy * cos_a*sin_b +
fy * sin_a*sin_b)
194 -
x * (0 * cos_g*sin_b +
ppy * cos_a*cos_b*cos_g -
fy * cos_b*cos_g*sin_a)
195 +
y * (0 * sin_b*sin_g +
ppy * cos_a*cos_b*sin_g -
fy * cos_b*sin_a*sin_g)
196 )*(
z*(0 * sin_b + 1 * cos_a*cos_b - 0 * cos_b*sin_a)
197 +
x * (0 * (cos_a*sin_g + cos_g * sin_a*sin_b)
198 + 1 * (sin_a*sin_g - cos_a * cos_g*sin_b)
200 +
y * (0 * (cos_a*cos_g - sin_a * sin_b*sin_g)
201 + 1 * (cos_g*sin_a + cos_a * sin_b*sin_g)
203 + 1 * (0 * t[0] + 0 * t[1] + 1 * t[2])
204 ))*(2 *
d[2] * x1 + 2 *
d[3] * y1 + x1 * (2 *
d[0] * y1 + 4 *
d[1] * y1*(xy2)+6 *
d[4] * y1*x2_y2))
205 ) / (
fy*(exp1*exp1));
215 const calib & yuy_intrin_extrin
218 auto r = yuy_intrin_extrin.
rot.
rot;
220 auto d = yuy_intrin_extrin.
coeffs;
226 auto sin_a = (double)sin( rot_angles.
alpha );
227 auto sin_b = (double)sin( rot_angles.
beta );
228 auto sin_g = (double)sin( rot_angles.
gamma );
230 auto cos_a = (double)cos( rot_angles.
alpha );
231 auto cos_b = (double)cos( rot_angles.
beta );
232 auto cos_g = (double)cos( rot_angles.
gamma );
233 auto x1 = (double)xy.
x;
234 auto y1 = (
double)xy.
y;
239 auto x2_y2 = xy2 * xy2;
241 auto x = (double)v.
x;
242 auto y = (
double)v.
y;
243 auto z = (double)v.
z;
245 auto exp1 =
z * cos_a*cos_b +
246 x * (sin_a*sin_g - cos_a * cos_g*sin_b) +
247 y * (cos_g*sin_a + cos_a * sin_b*sin_g) +
251 ((
y*(sin_a*sin_g - cos_a * cos_g*sin_b) -
x * (cos_g*sin_a + cos_a * sin_b*sin_g))*
252 (
z*(
fx*sin_b +
ppx * cos_a*cos_b) +
253 x * (
ppx*(sin_a*sin_g - cos_a * cos_g*sin_b) +
fx * cos_b*cos_g) +
254 y * (
ppx*(cos_g*sin_a + cos_a * sin_b*sin_g) -
fx * cos_b*sin_g) +
255 (
fx*t[0] +
ppx * t[2])) -
256 (
y*(
ppx* (sin_a*sin_g - cos_a * cos_g*sin_b) +
fx * cos_b*cos_g) -
257 x * (
ppx*(cos_g*sin_a + cos_a * sin_b*sin_g) -
fx * cos_b*sin_g))*
258 (
z*(cos_a*cos_b) +
x * (sin_a*sin_g - cos_a * cos_g*sin_b) +
259 y * (cos_g*sin_a + cos_a * sin_b*sin_g) + t[2]))*
260 (rc + 6 *
d[3] * x1 + 2 *
d[2] * y1 + x1 * (2 *
d[0] * x1 + 4 *
d[1] * x1*(xy2)+6 *
d[4] * x1*x2_y2))
263 (exp1* exp1) + (
fx*((
y*(sin_a*sin_g - cos_a * cos_g*sin_b) -
264 x * (cos_g*sin_a + cos_a * sin_b*sin_g))*
265 (
z*(
ppy*cos_a*cos_b -
fy * cos_b*sin_a) +
266 x * (
fy*(cos_a*sin_g + cos_g * sin_a*sin_b) +
ppy * (sin_a*sin_g - cos_a * cos_g*sin_b)) +
y *
267 (
fy*(cos_a*cos_g - sin_a * sin_b*sin_g) +
ppy *
268 (cos_g*sin_a + cos_a * sin_b*sin_g)) +
269 (
fy * t[1] +
ppy * t[2])) -
270 (
y*(
fy*(cos_a*sin_g + cos_g * sin_a*sin_b) +
271 ppy * (sin_a*sin_g - cos_a * cos_g*sin_b)) -
x *
272 (
fy*(cos_a*cos_g - sin_a * sin_b*sin_g) +
ppy * (cos_g*sin_a + cos_a * sin_b*sin_g)))*
273 (
z*cos_a*cos_b +
x * ((sin_a*sin_g - cos_a * cos_g*sin_b)) +
274 y * ((cos_g*sin_a + cos_a * sin_b*sin_g)) + t[2]))*(2 *
d[2] * x1 + 2 *
d[3] * y1 + x1 *
275 (2 *
d[0] * y1 + 4 *
d[1] * y1*xy2 + 6 *
d[4] * y1*x2_y2)) / (
fy*exp1*exp1));
285 const calib & yuy_intrin_extrin
288 auto r = yuy_intrin_extrin.
rot.
rot;
290 auto d = yuy_intrin_extrin.
coeffs;
296 auto sin_a = (double)sin( rot_angles.
alpha );
297 auto sin_b = (double)sin( rot_angles.
beta );
298 auto sin_g = (double)sin( rot_angles.
gamma );
300 auto cos_a = (double)cos( rot_angles.
alpha );
301 auto cos_b = (double)cos( rot_angles.
beta );
302 auto cos_g = (double)cos( rot_angles.
gamma );
303 auto x1 = (double)xy.
x;
304 auto y1 = (
double)xy.
y;
312 auto x2_y2 = xy2 * xy2;
314 auto x = (double)v.
x;
315 auto y = (
double)v.
y;
316 auto z = (double)v.
z;
319 auto exp1 =
z * (cos_a*cos_b) +
x * ((sin_a*sin_g - cos_a * cos_g*sin_b)) +
320 y * ((cos_g*sin_a + cos_a * sin_b*sin_g)) + t[2];
322 auto res = (((
x*(-(cos_a*sin_g + cos_g * sin_a*sin_b)) +
y * (-1 * (cos_a*cos_g - sin_a * sin_b*sin_g)) +
z *
323 (cos_b*sin_a))*(
z*(
ppy * cos_a*cos_b -
fy * cos_b*sin_a) +
x * (
fy*(cos_a*sin_g + cos_g * sin_a*sin_b) +
324 ppy * (sin_a*sin_g - cos_a * cos_g*sin_b)) +
y * (
fy*(cos_a*cos_g - sin_a * sin_b*sin_g) +
325 ppy * (cos_g*sin_a + cos_a * sin_b*sin_g)) + (
fy * t[1] +
ppy * t[2])) - (
x*(
fy*(sin_a*sin_g - cos_a * cos_g*sin_b) -
326 ppy * (cos_a*sin_g + cos_g * sin_a*sin_b)) +
y * (
fy*(cos_g*sin_a + cos_a * sin_b*sin_g) -
327 ppy * (cos_a*cos_g - sin_a * sin_b*sin_g)) +
z * (
fy*cos_a*cos_b +
ppy * cos_b*sin_a))*
328 (
z*(cos_a*cos_b) +
x * ((sin_a*sin_g - cos_a * cos_g*sin_b)) +
y * ((cos_g*sin_a + cos_a * sin_b*sin_g) - 0 * cos_b*sin_g) + (t[2])))*
329 (rc + 2 *
d[3] * x1 + 6 *
d[2] * y1 + y1 * (2 *
d[0] * y1 + 4 *
d[1] * y1*(xy2)+6 *
d[4] * y1*x2_y2))) /
330 (exp1*exp1) + (
fy*((
x*(-(cos_a*sin_g + cos_g * sin_a*sin_b)) +
y * (-(cos_a*cos_g - sin_a * sin_b*sin_g)) +
331 z * (cos_b*sin_a))*(
z*(
fx*sin_b +
ppx * cos_a*cos_b) +
x * (
ppx*(sin_a*sin_g - cos_a * cos_g*sin_b) +
fx * cos_b*cos_g) +
y *
332 (
ppx*(cos_g*sin_a + cos_a * sin_b*sin_g) -
fx * cos_b*sin_g) + (
fx*t[0] +
ppx * t[2])) - (
x*(-
ppx * (cos_a*sin_g + cos_g * sin_a*sin_b)) +
333 y * (-
ppx * (cos_a*cos_g - sin_a * sin_b*sin_g)) +
z * (
ppx*cos_b*sin_a))*(
z*(cos_a*cos_b - 0 * cos_b*sin_a) +
x * ((sin_a*sin_g - cos_a * cos_g*sin_b)) +
334 y * ((cos_g*sin_a + cos_a * sin_b*sin_g)) + (t[2])))*(2 *
d[2] * x1 + 2 *
d[3] * y1 + y1 * (2 *
d[0] * x1 + 4 *
d[1] * x1*(xy2)+6 *
d[4] * x1*x2_y2))) / (
fx*(exp1*exp1));
344 const calib & yuy_intrin_extrin
347 auto r = yuy_intrin_extrin.
rot.
rot;
349 auto d = yuy_intrin_extrin.
coeffs;
355 auto sin_a = (double)sin( rot_angles.
alpha );
356 auto sin_b = (double)sin( rot_angles.
beta );
357 auto sin_g = (double)sin( rot_angles.
gamma );
359 auto cos_a = (double)cos( rot_angles.
alpha );
360 auto cos_b = (double)cos( rot_angles.
beta );
361 auto cos_g = (double)cos( rot_angles.
gamma );
362 auto x1 = (double)xy.
x;
363 auto y1 = (
double)xy.
y;
368 auto x2_y2 = xy2 * xy2;
370 auto x = (double)v.
x;
371 auto y = (
double)v.
y;
372 auto z = (double)v.
z;
374 auto exp1 =
z * (cos_a*cos_b) +
x * ((sin_a*sin_g - cos_a * cos_g*sin_b))
375 +
y * ((cos_g*sin_a + cos_a * sin_b*sin_g)) + (t[2]);
377 auto res = -(((
z*(-cos_a * sin_b) -
x * (cos_a*cos_b*cos_g)
378 +
y * (cos_a*cos_b*sin_g))*(
z*(
ppy * cos_a*cos_b -
fy * cos_b*sin_a)
379 +
x * (
fy*(cos_a*sin_g + cos_g * sin_a*sin_b) +
ppy * (sin_a*sin_g - cos_a * cos_g*sin_b))
380 +
y * (
fy*(cos_a*cos_g - sin_a * sin_b*sin_g) +
ppy * (cos_g*sin_a + cos_a * sin_b*sin_g))
381 + (
fy * t[1] +
ppy * t[2])) - (
z*(0 * cos_b -
ppy * cos_a*sin_b +
fy * sin_a*sin_b)
382 -
x * (
ppy * cos_a*cos_b*cos_g -
fy * cos_b*cos_g*sin_a) +
y * (
ppy * cos_a*cos_b*sin_g -
fy * cos_b*sin_a*sin_g))*
383 (
z*(cos_a*cos_b) +
x * ((sin_a*sin_g - cos_a * cos_g*sin_b)) +
y * ((cos_g*sin_a + cos_a * sin_b*sin_g)) + t[2]))
384 *(rc + 2 *
d[3] * x1 + 6 *
d[2] * y1 + y1 * (2 *
d[0] * y1 + 4 *
d[1] * y1*(xy2)+6 *
d[4] * y1*x2_y2))) /
385 (exp1*exp1) - (
fy*((
z*(-cos_a * sin_b) -
x * (cos_a*cos_b*cos_g) +
y * (cos_a*cos_b*sin_g))*(
z*(
fx*sin_b +
ppx * cos_a*cos_b)
386 +
x * (
ppx * (sin_a*sin_g - cos_a * cos_g*sin_b) +
fx * cos_b*cos_g) +
y * (+
ppx * (cos_g*sin_a + cos_a * sin_b*sin_g) -
fx * cos_b*sin_g)
387 + (
fx*t[0] +
ppx * t[2])) - (
z*(
fx*cos_b -
ppx * cos_a*sin_b) -
x * (
fx*cos_g*sin_b +
ppx * cos_a*cos_b*cos_g) +
y 388 * (
fx*sin_b*sin_g +
ppx * cos_a*cos_b*sin_g))*(
z*(cos_a*cos_b) +
x * (sin_a*sin_g - cos_a * cos_g*sin_b) +
y 389 * (cos_g*sin_a + cos_a * sin_b*sin_g) + t[2]))*(2 *
d[2] * x1 + 2 *
d[3] * y1 + y1 *
390 (2 *
d[0] * x1 + 4 *
d[1] * x1*(xy2)+6 *
d[4] * x1*x2_y2))) / (
fx*(exp1*exp1));
401 const calib & yuy_intrin_extrin
404 auto r = yuy_intrin_extrin.
rot.
rot;
406 auto d = yuy_intrin_extrin.
coeffs;
412 auto sin_a = (double)sin( rot_angles.
alpha );
413 auto sin_b = (double)sin( rot_angles.
beta );
414 auto sin_g = (double)sin( rot_angles.
gamma );
416 auto cos_a = (double)cos( rot_angles.
alpha );
417 auto cos_b = (double)cos( rot_angles.
beta );
418 auto cos_g = (double)cos( rot_angles.
gamma );
419 auto x1 = (double)xy.
x;
420 auto y1 = (
double)xy.
y;
425 auto x2_y2 = xy2 * xy2;
431 auto exp1 =
z * (cos_a*cos_b) +
x * (+(sin_a*sin_g - cos_a * cos_g*sin_b))
432 +
y * ((cos_g*sin_a + cos_a * sin_b*sin_g)) + t[2];
434 auto res = (((
y*(+(sin_a*sin_g - cos_a * cos_g*sin_b)) -
x * ((cos_g*sin_a + cos_a * sin_b*sin_g)))
435 *(
z*(
ppy * cos_a*cos_b -
fy * cos_b*sin_a) +
x * (
fy*(cos_a*sin_g + cos_g * sin_a*sin_b)
436 +
ppy * (sin_a*sin_g - cos_a * cos_g*sin_b)) +
y * (
fy*(cos_a*cos_g - sin_a * sin_b*sin_g)
437 +
ppy * (cos_g*sin_a + cos_a * sin_b*sin_g))
438 + (
fy * t[1] +
ppy * t[2])) - (
y*(
fy*(cos_a*sin_g + cos_g * sin_a*sin_b) +
ppy * (sin_a*sin_g - cos_a * cos_g*sin_b))
439 -
x * (
fy*(cos_a*cos_g - sin_a * sin_b*sin_g) +
ppy * (cos_g*sin_a + cos_a * sin_b*sin_g)))*(
z*(cos_a*cos_b)
440 +
x * ((sin_a*sin_g - cos_a * cos_g*sin_b)) +
y * (+(cos_g*sin_a + cos_a * sin_b*sin_g)) + (t[2])))
441 *(rc + 2 *
d[3] * x1 + 6 *
d[2] * y1 + y1 * (2 *
d[0] * y1 + 4 *
d[1] * y1*(xy2)+6 *
d[4] * y1*x2_y2)))
442 / (exp1*exp1) + (
fy*((
y*(+(sin_a*sin_g - cos_a * cos_g*sin_b)) -
x * (+(cos_g*sin_a + cos_a * sin_b*sin_g)))
443 *(
z*(
fx*sin_b +
ppx * cos_a*cos_b) +
x * (
ppx * (sin_a*sin_g - cos_a * cos_g*sin_b) +
fx * cos_b*cos_g)
444 +
y * (+
ppx * (cos_g*sin_a + cos_a * sin_b*sin_g) -
fx * cos_b*sin_g) + (
fx*t[0] +
ppx * t[2]))
445 - (
y*(
ppx * (sin_a*sin_g - cos_a * cos_g*sin_b) +
fx * cos_b*cos_g) -
x 446 * (+
ppx * (cos_g*sin_a + cos_a * sin_b*sin_g) -
fx * cos_b*sin_g))*(
z*(cos_a*cos_b)
447 +
x * ((sin_a*sin_g - cos_a * cos_g*sin_b)) +
y * ((cos_g*sin_a + cos_a * sin_b*sin_g)) + (t[2])))
448 *(2 *
d[2] * x1 + 2 *
d[3] * y1 + y1 * (2 *
d[0] * x1 + 4 *
d[1] * x1*(xy2)+6 *
d[4] * x1*x2_y2))
449 ) / (
fx*(exp1*exp1));
472 auto x1 = (double)xy.
x;
473 auto y1 = (
double)xy.
y;
488 res.
vals[0] = (
x*(rc + 6*
d[3]*x1 + 2*
d[2]*y1 + x1*(2*
d[0]*x1 + 4*
d[1]*x1*(r2)+6*
d[4]*x1*r4))
489 )/ (
p[8]*
x +
p[9]*
y +
p[10]*
z +
p[11]*1);
491 res.
vals[1] = (
y*(rc + 6*
d[3]*x1 + 2*
d[2]*y1 + x1*(2*
d[0]*x1 + 4*
d[1]*x1*(r2)+6*
d[4]*x1*r4))
492 )/ (
p[8]*
x +
p[9]*
y +
p[10]*
z +
p[11]*1);
494 res.
vals[2] = (
z*(rc + 6*
d[3]*x1 + 2*
d[2]*y1 + x1*(2*
d[0]*x1 + 4*
d[1]*x1*(r2)+6*
d[4]*x1*r4))
495 )/ (
p[8]*
x +
p[9]*
y +
p[10]*
z +
p[11]*1);
497 res.
vals[3] = (1*(rc + 6*
d[3]*x1 + 2*
d[2]*y1 + x1*(2*
d[0]*x1 + 4*
d[1]*x1*(r2)+6*
d[4]*x1*r4))
498 )/ (
p[8]*
x +
p[9]*
y +
p[10]*
z +
p[11]*1);
500 res.
vals[4] = (
fx*
x*(2*
d[2]*x1 + 2*
d[3]*y1 + x1*(2*
d[0]*y1 + 4*
d[1]*y1*(r2)+6*
d[4]*y1*r4))
501 )/ (
fy*(
p[8]*
x +
p[9]*
y +
p[10]*
z +
p[11]*1));
503 res.
vals[5] = (
fx*
y*(2*
d[2]*x1 + 2*
d[3]*y1 + x1*(2*
d[0]*y1 + 4*
d[1]*y1*(r2)+6*
d[4]*y1*r4))
504 )/ (
fy*(
p[8]*
x +
p[9]*
y +
p[10]*
z +
p[11]*1));
506 res.
vals[6] = (
fx*
z*(2*
d[2]*x1 + 2*
d[3]*y1 + x1*(2*
d[0]*y1 + 4*
d[1]*y1*(r2)+6*
d[4]*y1*r4))
507 )/ (
fy*(
p[8]*
x +
p[9]*
y +
p[10]*
z +
p[11]*1));
509 res.
vals[7] = (
fx*1*(2*
d[2]*x1 + 2*
d[3]*y1 + x1*(2*
d[0]*y1 + 4*
d[1]*y1*(r2)+6*
d[4]*y1*r4))
510 )/ (
fy*(
p[8]*
x +
p[9]*
y +
p[10]*
z +
p[11]*1));
512 double exp =
p[8] *
x +
p[9] *
y +
p[10] *
z +
p[11];
513 double exp2 = exp * exp;
515 res.
vals[8] = -(
x*(p[0]*
x + p[1]*
y + p[2]*
z + p[3]*1)
516 *(rc + 6*
d[3]*x1 + 2*
d[2]*y1 + x1*(2*
d[0]*x1 + 4*
d[1]*x1*(r2)+6*
d[4]*x1*r4))
517 )/ exp2 - (
fx*
x*(2*
d[2]*x1 + 2*
d[3]*y1 + x1*(2*
d[0]*y1 + 4*
d[1]*y1*(r2)+6*
d[4]*y1*r4))
518 *(p[4]*
x + p[5]*
y + p[6]*
z + p[7]*1)
522 res.
vals[9] = - (
y*(p[0]*
x + p[1]*
y + p[2]*
z + p[3]*1)
523 *(rc + 6*
d[3]*x1 + 2*
d[2]*y1 + x1*(2*
d[0]*x1 + 4*
d[1]*x1*(r2)+6*
d[4]*x1*r4))
524 ) / exp2 - (
fx*
y*(2*
d[2]*x1 + 2*
d[3]*y1 + x1*(2*
d[0]*y1 + 4*
d[1]*y1*(r2)+6*
d[4]*y1*r4))
525 *(p[4]*
x + p[5]*
y + p[6]*
z + p[7]*1)
528 res.
vals[10] = - (
z*(p[0]*
x + p[1]*
y + p[2]*
z + p[3]*1)
529 *(rc + 6*
d[3]*x1 + 2*
d[2]*y1 + x1*(2*
d[0]*x1 + 4*
d[1]*x1*(r2)+6*
d[4]*x1*r4))
530 ) / exp2 - (
fx*
z*(2*
d[2]*x1 + 2*
d[3]*y1 + x1*(2*
d[0]*y1 + 4*
d[1]*y1*(r2)+6*
d[4]*y1*r4))
531 *(p[4]*
x + p[5]*
y + p[6]*
z + p[7]*1)
534 res.
vals[11] = -(1 * (p[0] *
x + p[1] *
y + p[2] *
z + p[3] * 1)
535 *(rc + 6 *
d[3] * x1 + 2 *
d[2] * y1 + x1 * (2 *
d[0] * x1 + 4 *
d[1] * x1*(r2)+6 *
d[4] * x1*r4))
536 ) / exp2 - (
fx * 1 * (2 *
d[2] * x1 + 2 *
d[3] * y1 + x1 * (2 *
d[0] * y1 + 4 *
d[1] * y1*(r2)+6 *
d[4] * y1*r4))
537 *(p[4] *
x + p[5] *
y + p[6] *
z + p[7] * 1)
561 auto x1 = (double)xy.
x;
562 auto y1 = (
double)xy.
y;
573 double exp =
p[8] *
x +
p[9] *
y +
p[10] *
z +
p[11] * 1;
574 double exp2 = exp * exp;
575 res.
vals[0] = (
fy*
x*(2*
d[2]*x1 + 2*
d[3]*y1 + y1*(2*
d[0]*x1 + 4*
d[1]*x1*(r2)+6*
d[4]*x1*r4))
576 )/ (
fx*(p[8]*
x + p[9]*
y + p[10]*
z + p[11]*1));
577 res.
vals[1] = (
fy*
y*(2*
d[2]*x1 + 2*
d[3]*y1 + y1*(2*
d[0]*x1 + 4*
d[1]*x1*(r2)+6*
d[4]*x1*r4))
578 )/ (
fx*(p[8]*
x + p[9]*
y + p[10]*
z + p[11]*1));
579 res.
vals[2] = (
fy*
z*(2*
d[2]*x1 + 2*
d[3]*y1 + y1*(2*
d[0]*x1 + 4*
d[1]*x1*(r2)+6*
d[4]*x1*r4))
580 )/ (
fx*(p[8]*
x + p[9]*
y + p[10]*
z + p[11]*1));
581 res.
vals[3] = (
fy*1*(2*
d[2]*x1 + 2*
d[3]*y1 + y1*(2*
d[0]*x1 + 4*
d[1]*x1*(r2)+6*
d[4]*x1*r4))
582 )/ (
fx*(p[8]*
x + p[9]*
y + p[10]*
z + p[11]*1));
583 res.
vals[4] = (
x*(rc + 2*
d[3]*x1 + 6*
d[2]*y1 + y1*(2*
d[0]*y1 + 4*
d[1]*y1*(r2)+6*
d[4]*y1*r4))
584 )/ (p[8]*
x + p[9]*
y + p[10]*
z + p[11]*1);
585 res.
vals[5] = (
y*(rc + 2*
d[3]*x1 + 6*
d[2]*y1 + y1*(2*
d[0]*y1 + 4*
d[1]*y1*(r2)+6*
d[4]*y1*r4))
586 )/ (p[8]*
x + p[9]*
y + p[10]*
z + p[11]*1);
587 res.
vals[6] = (
z*(rc + 2*
d[3]*x1 + 6*
d[2]*y1 + y1*(2*
d[0]*y1 + 4*
d[1]*y1*(r2)+6*
d[4]*y1*r4))
588 )/ (p[8]*
x + p[9]*
y + p[10]*
z + p[11]*1);
589 res.
vals[7] = (1*(rc + 2*
d[3]*x1 + 6*
d[2]*y1 + y1*(2*
d[0]*y1 + 4*
d[1]*y1*(r2)+6*
d[4]*y1*r4))
590 )/ (p[8]*
x + p[9]*
y + p[10]*
z + p[11]*1);
591 res.
vals[8] = - (
x*(p[4]*
x + p[5]*
y + p[6]*
z + p[7]*1)
592 *(rc + 2*
d[3]*x1 + 6*
d[2]*y1 + y1*(2*
d[0]*y1 + 4*
d[1]*y1*(r2)+6*
d[4]*y1*r4))
593 )/ exp2 - (
fy*
x*(2*
d[2]*x1 + 2*
d[3]*y1 + y1*(2*
d[0]*x1 + 4*
d[1]*x1*(r2)+6*
d[4]*x1*r4))
594 *(p[0]*
x + p[1]*
y + p[2]*
z + p[3]*1)
596 res.
vals[9] = - (
y*(p[4]*
x + p[5]*
y + p[6]*
z + p[7]*1)
597 *(rc + 2*
d[3]*x1 + 6*
d[2]*y1 + y1*(2*
d[0]*y1 + 4*
d[1]*y1*(r2)+6*
d[4]*y1*r4))
598 )/ exp2 - (
fy*
y*(2*
d[2]*x1 + 2*
d[3]*y1 + y1*(2*
d[0]*x1 + 4*
d[1]*x1*(r2)+6*
d[4]*x1*r4))
599 *(p[0]*
x + p[1]*
y + p[2]*
z + p[3]*1)
601 res.
vals[10] = - (
z*(p[4]*
x + p[5]*
y + p[6]*
z + p[7]*1)
602 *(rc + 2*
d[3]*x1 + 6*
d[2]*y1 + y1*(2*
d[0]*y1 + 4*
d[1]*y1*(r2)+6*
d[4]*y1*r4))
603 )/ exp2 - (
fy*
z*(2*
d[2]*x1 + 2*
d[3]*y1 + y1*(2*
d[0]*x1 + 4*
d[1]*x1*(r2)+6*
d[4]*x1*r4))
604 *(p[0]*
x + p[1]*
y + p[2]*
z + p[3]*1)
606 res.
vals[11] = - (1*(p[4]*
x + p[5]*
y + p[6]*
z + p[7]*1)
607 *(rc + 2*
d[3]*x1 + 6*
d[2]*y1 + y1*(2*
d[0]*y1 + 4*
d[1]*y1*(r2)+6*
d[4]*y1*r4))
608 )/ exp2 - (
fy*1*(2*
d[2]*x1 + 2*
d[3]*y1 + y1*(2*
d[0]*x1 + 4*
d[1]*x1*(r2)+6*
d[4]*x1*r4))
609 *(p[0]*
x + p[1]*
y + p[2]*
z + p[3]*1)
617 const calib & yuy_intrin_extrin,
618 const std::vector<double>& rc,
619 const std::vector<double2>& xy
628 for(
auto i = 0;
i <
v.size();
i++ )
646 auto x1 = (double)xy.
x;
647 auto y1 = (
double)xy.
y;
652 auto x2_y2 = xy2 * xy2;
654 auto r = yuy_intrin_extrin.
rot.
rot;
656 auto d = yuy_intrin_extrin.
coeffs;
662 auto x = (double)v.
x;
663 auto y = (
double)v.
y;
664 auto z = (double)v.
z;
666 auto exp1 = rc + 6 * (
double)
d[3] * x1 + 2 * (double)
d[2] * y1 + x1 *
667 (2 * (
double)
d[0] * x1 + 4 * (double)
d[1] * x1*(xy2)+6 * (double)
d[4] * x1*(x2_y2));
668 auto exp2 =
fx * (double)
r[2] *
x +
fx * (
double)
r[5] *
y +
fx * (double)
r[8] *
z +
fx * (
double)t[2];
669 auto exp3 = (double)
r[2] *
x + (
double)
r[5] *
y + (double)
r[8] *
z + (
double)t[2];
671 res.
t1 = (exp1 * exp2) / (exp3 * exp3);
673 auto exp4 = 2 * (double)
d[2] * x1 + 2 * (
double)
d[3] * y1 + x1 *
674 (2 * (double)
d[0] * y1 + 4 * (
double)
d[1] * y1*xy2 + 6 * (double)
d[4] * y1*x2_y2);
675 auto exp5 = -
fy * (double)
r[2] *
x -
fy * (
double)
r[5] *
y -
fy * (double)
r[8] *
z -
fy * (
double)t[2];
676 auto exp6 = (double)
r[2] *
x + (
double)
r[5] *
y + (double)
r[8] *
z + (
double)t[2];
678 res.
t2 = -(
fx*exp4 * exp5) / (
fy*exp6 * exp6);
680 exp1 = rc + 6 * (double)
d[3] * x1 + 2 * (
double)
d[2] * y1 + x1
681 * (2 * (double)
d[0] * x1 + 4 * (
double)
d[1] * x1*(xy2)+6 * (
double)
d[4] * x1*x2_y2);
682 exp2 =
fx * (double)
r[0] *
x +
fx * (
double)
r[3] *
y +
fx * (double)
r[6] *
z +
fx * (
double)t[0];
683 exp3 = (double)
r[2] *
x + (
double)
r[5] *
y + (double)
r[8] *
z + (
double)t[2];
684 exp4 =
fx * (2 * (double)
d[2] * x1 + 2 * (
double)
d[3] * y1 +
685 x1 * (2 * (double)
d[0] * y1 + 4 * (
double)
d[1] * y1*(xy2)+6 * (
double)
d[4] * y1*x2_y2));
686 exp5 = +
fy * (double)
r[1] *
x +
fy * (
double)
r[4] *
y +
fy * (double)
r[7] *
z +
fy * (
double)t[1];
687 exp6 = (double)
r[2] *
x + (
double)
r[5] *
y + (double)
r[8] *
z + (
double)t[2];
689 res.
t3 = -(exp1 * exp2) / (exp3 * exp3) - (exp4 * exp5) / (
fy*exp6 * exp6);
696 const std::vector<double3>& new_vertices,
700 const std::vector<double>& rc,
701 const std::vector<double2>& xy)
705 auto v = new_vertices;
709 for (
auto i = 0;
i < rc.size();
i++)
rotation_in_angles extract_angles_from_rotation(const double r[9])
std::vector< double3 > vertices
GLdouble GLdouble GLdouble y2
double calculate_rotation_x_gamma_coeff(rotation_in_angles const &rot_angles, double3 const &v, double rc, double2 const &xy, const calib &yuy_intrin_extrin)
double calculate_rotation_x_alpha_coeff(rotation_in_angles const &rot_angles, double3 const &v, double rc, double2 const &xy, const calib &yuy_intrin_extrin)
static double calculate_rotation_x_beta_coeff(rotation_in_angles const &rot_angles, double3 const &v, double rc, double2 const &xy, const calib &yuy_intrin_extrin)
translation calculate_translation_x_coeff(double3 v, double rc, double2 xy, const calib &yuy_intrin_extrin)
coeffs< rotation_in_angles > calc_rotation_coefs(const z_frame_data &z_data, const yuy2_frame_data &yuy_data, const calib &yuy_intrin_extrin, const std::vector< double > &rc, const std::vector< double2 > &xy)
p_matrix calculate_p_x_coeff(double3 const &v, double rc, double2 const &xy, const calib &cal, const p_matrix &p_mat)
std::vector< T > y_coeffs
double calculate_rotation_y_alpha_coeff(rotation_in_angles const &rot_angles, double3 const &v, double rc, double2 const &xy, const calib &yuy_intrin_extrin)
double calculate_rotation_y_gamma_coeff(rotation_in_angles const &rot_angles, double3 const &v, double rc, double2 const &xy, const calib &yuy_intrin_extrin)
GLuint GLfloat GLfloat GLfloat x1
coeffs< p_matrix > calc_p_coefs(const z_frame_data &z_data, const std::vector< double3 > &new_vertices, const yuy2_frame_data &yuy_data, const calib &cal, const p_matrix &p_mat, const std::vector< double > &rc, const std::vector< double2 > &xy)
double calculate_rotation_y_beta_coeff(rotation_in_angles const &rot_angles, double3 const &v, double rc, double2 const &xy, const calib &yuy_intrin_extrin)
std::vector< T > x_coeffs
p_matrix calculate_p_y_coeff(double3 const &v, double rc, double2 const &xy, const calib &cal, const p_matrix &p_mat)