76 const int N = nPoints;
77 const Vec3d *M = pPoints3D;
78 const Vec2d *m = pPoints2D;
82 printf(
"error: too few points for POSIT\n");
95 for (l = 0; l < N_; l++)
97 A(0, l) = M[l + 1].
x - M[0].
x;
98 A(1, l) = M[l + 1].
y - M[0].
y;
99 A(2, l) = M[l + 1].
z - M[0].
z;
110 float *e =
new float[N_];
111 for (l = 0; l < N_; l++)
118 for (
int n = 0;
n < nIterations;
n++)
121 for (l = 0; l < N_; l++)
123 x_.
data[l] = (m[l + 1].
x - cx) * (1.0f + e[l]) - (m[0].
x - cx);
124 y_.
data[l] = (m[l + 1].
y - cy) * (1.0f + e[l]) - (m[0].
y - cy);
131 Math3d::SetVec(i,
float(I.data[0]),
float(I.data[1]),
float(I.data[2]));
136 s = 0.5f * (s1 + s2);
145 const float Z0 = f /
s;
147 for (l = 0; l < N_; l++)
149 Vec3d M0Mi = { float(A(0, l)), float(A(1, l)), float(A(2, l)) };
Mat3d m_rotation_inverse
Rotation matrix of the inverted extrinsic transformation.
void CrossProduct(const Vec3d &vector1, const Vec3d &vector2, Vec3d &result)
float ScalarProduct(const Vec3d &vector1, const Vec3d &vector2)
Data structure for the representation of a 3D vector.
float Length(const Vec3d &vec)
Data structure for the representation of a vector of values of the data type double.
const CCameraParameters & GetCameraParameters() const
Gives access to the camera parameters.
void SetVec(Vec3d &vec, float x, float y, float z)
void MulVecScalar(const Vec3d &vec, float scalar, Vec3d &result)
void MulMatMat(const Mat3d &matrix1, const Mat3d &matrix2, Mat3d &result)
void MulMatVec(const Mat3d &matrix, const Vec3d &vec, Vec3d &result)
void MulMatVec(const CFloatMatrix *pMatrix, const CFloatVector *pVector, CFloatVector *pResultVector)
Vec3d m_translation_inverse
Translation vector of the inverted extrinsic transformation.
void CalculatePseudoInverseSVD(const CFloatMatrix *pInputMatrix, CFloatMatrix *pOutputMatrix)
void SubtractFromVec(Vec3d &vec, const Vec3d &vectorToSubtract)
void NormalizeVec(Vec3d &vec)
Data structure for the representation of a 2D vector.
Data structure for the representation of a matrix of values of the data type double.
bool POSIT(const Vec3d *pPoints3D, const Vec2d *pPoints2D, int nPoints, Mat3d &R, Vec3d &t, const CCalibration *pCalibration, int nIterations=20)
void SetMat(Mat3d &matrix, float r1, float r2, float r3, float r4, float r5, float r6, float r7, float r8, float r9)
Data structure for the representation of a 3x3 matrix.
Camera model parameters and functions for a single camera.