SLAMflex SE  0.1.0
SLAMflex provides detection and tracking of dominant planes for smartphone devices. This plane can then be used to show AR content relative to the plane orientation. The detection of plane is performed in the field of view of the smartphone camera. In subsequent frames it is tracked. The interface returns the plane position and orientation.
SmallMatrixOpts.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 // Copyright 2008 Isis Innovation Limited
3 //
4 // Inverse of 2-matrix
5 // Must be invertible!
6 #ifndef __SMALL_MATRIX_OPTS
7 #define __SMALL_MATRIX_OPTS
8 #include <cassert>
9 
10 inline Matrix<2> M2Inverse(const Matrix<2> &m)
11 {
12  Matrix<2> m2Res;
13  double dDet = m[0][0] * m[1][1] - m[1][0] * m[0][1];
14  assert(dDet!=0.0);
15  double dInverseDet = 1.0 / dDet;
16  m2Res[0][0] = m[1][1] * dInverseDet;
17  m2Res[1][1] = m[0][0] * dInverseDet;
18  m2Res[1][0] = -m[1][0] * dInverseDet;
19  m2Res[0][1] = -m[0][1] * dInverseDet;
20  return m2Res;
21 };
22 
23 // Determinant of 2x2
24 inline double M2Det(Matrix<2> m)
25 {
26  return m[0][0] * m[1][1] - m[0][1] * m[1][0];
27 }
28 
29 // Determinant of 3x3
30 inline double M3Det(Matrix<3> m )
31 {
32  return
33  m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1]) -
34  m[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0]) +
35  m[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]);
36 }
37 
38 #endif
double M2Det(Matrix< 2 > m)
double M3Det(Matrix< 3 > m)
Matrix< 2 > M2Inverse(const Matrix< 2 > &m)