122 Mat3d &rotationMatrix,
Vec3d &translationVector,
127 printf(
"error: too few points for object pose estimation.\n");
139 m_pQ[i].
x = (pImagePoints[i].
x - principalPoint.
x) / focalLength.
x;
140 m_pQ[i].
y = (pImagePoints[i].
y - principalPoint.
y) / focalLength.
y;
168 float old_error, new_error;
171 AbsKernel(rotationMatrix, translationVector, old_error);
173 AbsKernel(rotationMatrix, translationVector, new_error);
176 while (fabsf((old_error - new_error) / old_error) >
TOL && new_error >
EPSILON && it < nMaxIterations)
178 old_error = new_error;
179 AbsKernel(rotationMatrix, translationVector, new_error);
217 for (i = 0; i < 9; i++)
236 transU.
r1 = float(fU.
data[0]); transU.
r2 = float(fU.
data[1]); transU.
r3 = float(fU.
data[2]);
237 transU.
r4 = float(fU.
data[3]); transU.
r5 = float(fU.
data[4]); transU.
r6 = float(fU.
data[5]);
238 transU.
r7 = float(fU.
data[6]); transU.
r8 = float(fU.
data[7]); transU.
r9 = float(fU.
data[8]);
241 temp.
r1 = float(fV.
data[0]); temp.
r2 = float(fV.
data[1]); temp.
r3 = float(fV.
data[2]);
242 temp.
r4 = float(fV.
data[3]); temp.
r5 = float(fV.
data[4]); temp.
r6 = float(fV.
data[5]);
243 temp.
r7 = float(fV.
data[6]); temp.
r8 = float(fV.
data[7]); temp.
r9 = float(fV.
data[8]);
255 temp.
r1 = float(-fV.
data[0]); temp.
r2 = float(-fV.
data[1]); temp.
r3 = float(fV.
data[2]);
256 temp.
r4 = float(-fV.
data[3]); temp.
r5 = float(-fV.
data[4]); temp.
r6 = float(fV.
data[5]);
257 temp.
r7 = float(-fV.
data[6]); temp.
r8 = float(-fV.
data[7]); temp.
r9 = float(fV.
data[8]);
266 temp.
r1 = float(fV.
data[0]); temp.
r2 = float(fV.
data[1]); temp.
r3 = float(-fV.
data[2]);
267 temp.
r4 = float(fV.
data[3]); temp.
r5 = float(fV.
data[4]); temp.
r6 = float(-fV.
data[5]);
268 temp.
r7 = float(fV.
data[6]); temp.
r8 = float(fV.
data[7]); temp.
r9 = float(-fV.
data[8]);
276 temp.
r1 = float(-fV.
data[0]); temp.
r2 = float(-fV.
data[1]); temp.
r3 = float(-fV.
data[2]);
277 temp.
r4 = float(-fV.
data[3]); temp.
r5 = float(-fV.
data[4]); temp.
r6 = float(-fV.
data[5]);
278 temp.
r7 = float(-fV.
data[6]); temp.
r8 = float(-fV.
data[7]); temp.
r9 = float(-fV.
data[8]);
void MulVecTransposedVec(const Vec3d &vector1, const Vec3d &vector2, Mat3d &result)
Mat3d m_rotation_inverse
Rotation matrix of the inverted extrinsic transformation.
float SquaredLength(const Vec3d &vec)
void AddToMat(Mat3d &matrix, const Mat3d &matrixToAdd)
Data structure for the representation of a 3D vector.
void SVD(const CFloatMatrix *A, CFloatMatrix *W, CFloatMatrix *U=0, CFloatMatrix *V=0, bool bAllowModifyA=false, bool bReturnUTransposed=false, bool bReturnVTransposed=false)
const CCameraParameters & GetCameraParameters() const
Gives access to the camera parameters.
bool EstimatePose(const Vec2d *pImagePoints, Mat3d &rotationMatrix, Vec3d &translationVector, const CCalibration *pCalibration, int nMaxIterations=350)
void MulVecScalar(const Vec3d &vec, float scalar, Vec3d &result)
void SubtractMatMat(const Mat3d &matrix1, const Mat3d &matrix2, Mat3d &result)
void AddVecVec(const Vec3d &vector1, const Vec3d &vector2, Vec3d &result)
void Invert(const Mat3d &matrix, Mat3d &result)
void MulMatMat(const Mat3d &matrix1, const Mat3d &matrix2, Mat3d &result)
void AddToVec(Vec3d &vec, const Vec3d &vectorToAdd)
void MulMatScalar(const Mat3d &matrix, float scalar, Mat3d &result)
void MulMatVec(const Mat3d &matrix, const Vec3d &vec, Vec3d &result)
CObjectPose(const Vec3d *pObjectPoints, int nPoints)
Vec3d m_translation_inverse
Translation vector of the inverted extrinsic transformation.
Data structure for the representation of a 2D vector.
Data structure for the representation of a matrix of values of the data type double.
void SubtractVecVec(const Vec3d &vector1, const Vec3d &vector2, Vec3d &result)
Vec3d tEstimate(Mat3d &R)
void Transpose(const CFloatMatrix *pMatrix, CFloatMatrix *pResultMatrix)
void AbsKernel(Mat3d &R, Vec3d &T, float &error)
float Det(const Mat3d &matrix)
Data structure for the representation of a 3x3 matrix.
Camera model parameters and functions for a single camera.