30 assert(2 == x1.rows());
31 assert(2 == x1.cols());
32 assert(x1.rows() == x2.rows());
33 assert(x1.cols() == x2.cols());
39 double a12 = xx1.dot(yx1);
42 double b12 = xx2.dot(yx2);
44 double a1 = xx1.squaredNorm();
45 double a2 = yx1.squaredNorm();
47 double b1 = xx2.squaredNorm();
48 double b2 = yx2.squaredNorm();
56 P[0] = b1 * b2 * a12 * a12 - a1 * a2 * b12 * b12;
57 P[1] = -2 * a1 * a2 * b12 + 2 * a12 * b1 * b2 + b1 * a12 * a12 +
58 b2 * a12 * a12 - a1 * b12 * b12 - a2 * b12 * b12;
59 P[2] = b1 * b2 - a1 * a2 - 2 * a1 * b12 - 2 * a2 * b12 + 2 * a12 * b1 +
60 2 * a12 * b2 + a12 * a12 - b12 * b12;
61 P[3] = b1 + b2 - 2 * b12 - a1 - a2 + 2 * a12;
86 for (
int i = 0; i < num_roots; ++i) {
88 fs->push_back(
sqrt(roots[i]));
103 assert(3 == x1.rows());
104 assert(2 <= x1.cols());
105 assert(x1.rows() == x2.rows());
106 assert(x1.cols() == x2.cols());
109 Mat3 K(Mat3::Identity() * 1.0 / focal);
113 Mat3 C = Mat3::Zero();
114 for (
int i = 0; i < x1.cols(); ++i) {
117 C += r2i * r1i.transpose();
121 Eigen::JacobiSVD<Mat> svd(C, Eigen::ComputeThinU | Eigen::ComputeThinV);
122 Mat3 scale = Mat3::Identity();
124 ((svd.matrixU() * svd.matrixV().transpose()).
determinant() > 0.0) ? 1.0
127 (*R) = svd.matrixU() * scale * svd.matrixV().transpose();
btMatrix3x3 transpose() const
Return the transpose of the matrix.
btScalar determinant() const
Return the determinant of the matrix.
SIMD_FORCE_INLINE btVector3 normalized() const
Return a normalized version of this vector.
int SolveCubicPolynomial(Real a, Real b, Real c, Real *x0, Real *x1, Real *x2)
Eigen::Matrix< double, 3, 3 > Mat3
static bool Build_Minimal2Point_PolynomialFactor(const Mat &x1, const Mat &x2, double *P)
void F_FromCorrespondance_2points(const Mat &x1, const Mat &x2, vector< double > *fs)
void GetR_FixedCameraCenter(const Mat &x1, const Mat &x2, const double focal, Mat3 *R)