| 41 | namespace { |
| 42 | |
| 43 | TEST(DecomposeEssentialMatrix, Nominal) { |
| 44 | const Rigid3d cam2_from_cam1(Eigen::Quaterniond::UnitRandom(), |
| 45 | Eigen::Vector3d(0.5, 1, 1).normalized()); |
| 46 | const Eigen::Matrix3d cam2_from_cam1_rot_mat = |
| 47 | cam2_from_cam1.rotation().toRotationMatrix(); |
| 48 | const Eigen::Matrix3d E = EssentialMatrixFromPose(cam2_from_cam1); |
| 49 | |
| 50 | Eigen::Matrix3d R1; |
| 51 | Eigen::Matrix3d R2; |
| 52 | Eigen::Vector3d t; |
| 53 | DecomposeEssentialMatrix(E, &R1, &R2, &t); |
| 54 | |
| 55 | EXPECT_TRUE((R1 - cam2_from_cam1_rot_mat).norm() < 1e-10 || |
| 56 | (R2 - cam2_from_cam1_rot_mat).norm() < 1e-10); |
| 57 | EXPECT_TRUE((t - cam2_from_cam1.translation()).norm() < 1e-10 || |
| 58 | (t + cam2_from_cam1.translation()).norm() < 1e-10); |
| 59 | } |
| 60 | |
| 61 | TEST(EssentialMatrixFromPose, Nominal) { |
| 62 | EXPECT_EQ(EssentialMatrixFromPose(Rigid3d(Eigen::Quaterniond::Identity(), |
nothing calls this directly
no test coverage detected