20 rot = {
r[0],
r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8] };
23 0,intrin.
fy, intrin.
ppy,
42 rot = {
r[0],
r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8] };
45 0,intrin.
fy, intrin.
ppy,
68 {
r[0] ,
r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8] },
83 k[0] *
r[0] + k[1] *
r[3] + k[2] *
r[6],
84 k[0] * r[1] + k[1] * r[4] + k[2] * r[7],
85 k[0] * r[2] + k[1] * r[5] + k[2] * r[8],
86 k[0] *
t.t1 + k[1] *
t.t2 + k[2] *
t.t3,
88 k[3] * r[0] + k[4] * r[3] + k[5] * r[6],
89 k[3] * r[1] + k[4] * r[4] + k[5] * r[7],
90 k[3] * r[2] + k[4] * r[5] + k[5] * r[8],
91 k[3] *
t.t1 + k[4] *
t.t2 + k[5] *
t.t3,
119 for (
auto i = 0;
i < 9;
i++)
124 for (
auto i = 0;
i < 9;
i++)
125 res.
rot.
rot[
i] = this->rot.rot[
i] * step_size;
127 res.
trans.
t1 = this->trans.t1 *step_size;
128 res.
trans.
t2 = this->trans.t2 * step_size;
129 res.
trans.
t3 = this->trans.t3 *step_size;
138 return (*
this)*(1.f / factor);
145 for (
auto i = 0;
i < 9;
i++)
150 for (
auto i = 0;
i < 9;
i++)
165 for (
auto i = 0;
i < 9;
i++)
170 for (
auto i = 0;
i < 9;
i++)
186 for (
auto i = 0;
i < 9;
i++)
191 for (
auto i = 0;
i < 9;
i++)
209 for (
auto i = 0;
i < 12;
i++)
210 res.
vals[
i] = vals[
i] * step_size;
217 return (*
this)*(1.f / factor);
223 for (
auto i = 0;
i < 12;
i++)
232 for (
auto i = 0;
i < 12;
i++)
241 for (
auto i = 0;
i < 12;
i++)
250 for (
auto i = 0;
i < 12;
i++)
258 double grads_norm = 0;
260 for (
auto i = 0;
i < 12;
i++)
261 grads_norm += vals[
i] * vals[
i];
263 grads_norm = sqrt(grads_norm);
268 static inline bool rtIsNaN(
double value ) {
return (value != value); }
271 return ( value == std::numeric_limits< double >::infinity()
272 || value == -std::numeric_limits< double >::infinity() );
293 for(
int j = 0;
j < 4;
j++ )
295 absx = std::abs( m[3 *
j] );
296 if(
rtIsNaN( absx ) || ( absx > n ) )
299 absx = std::abs( m[1 + 3 * j] );
300 if(
rtIsNaN( absx ) || ( absx > n ) )
303 absx = std::abs( m[2 + 3 * j] );
304 if(
rtIsNaN( absx ) || ( absx > n ) )
319 for(
auto i = 0;
i < 12;
i++ )
327 for(
auto i = 0;
i < 12;
i++ )
328 res.
vals[
i] = vals[
i] / norma;
335 double3x3 first_three_cols = { vals[0], vals[1], vals[2],
336 vals[4], vals[5], vals[6],
337 vals[8], vals[9], vals[10] };
340 auto k_square = first_three_cols * first_three_cols.
transpose();
342 std::vector<double> inv_k_square_vac( 9, 0 );
343 inv( k_square.to_vector().data(), inv_k_square_vac.data() );
345 double3x3 inv_k_square = { inv_k_square_vac[0], inv_k_square_vac[3], inv_k_square_vac[6],
346 inv_k_square_vac[1], inv_k_square_vac[4], inv_k_square_vac[7],
347 inv_k_square_vac[2], inv_k_square_vac[5], inv_k_square_vac[8] };
353 inv( k_inv.to_vector().data(), k_vac.
rot );
355 for(
auto i = 0;
i < 9;
i++ )
356 k_vac.
rot[
i] /= k_vac.
rot[9 - 1];
359 auto t = k_inv *
double3{ vals[3], vals[7], vals[11] };
362 auto r = (k_inv * first_three_cols).to_vector();
365 for(
auto i = 0;
i <
r.size();
i++ )
368 calibration.
trans = {
t.x,
t.y,
t.z };
376 calib const & in_calibration )
calib operator-(const calib &c) const
rs2_extrinsics_double get_extrinsics() const
void inv(const double x[9], double y[9])
p_matrix normalize(double norm) const
double matrix_norm() const
p_matrix operator/(double factor) const
p_matrix operator+(const p_matrix &c) const
rs2_intrinsics_double get_intrinsics() const
p_matrix operator-(const p_matrix &c) const
calib decompose(p_matrix const &mat, calib const &)
static bool rtIsNaN(double value)
static bool rtIsInf(double value)
p_matrix const calc_p_mat() const
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented...
calib operator+(const calib &c) const
GLint GLsizei GLsizei height
double3x3 cholesky3x3(double3x3 const &mat)
calib operator*(double step_size) const
void copy_coefs(calib &obj) const
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented...
calib operator/(double factor) const
void svd_3x4(const double in[12], double out[3])
p_matrix operator*(double step_size) const