Fill the configuration, essential matrix, and (for perspective pairs) fundamental matrix of a synthetic two-view geometry.
| 76 | // Fill the configuration, essential matrix, and (for perspective pairs) |
| 77 | // fundamental matrix of a synthetic two-view geometry. |
| 78 | void SetTwoViewGeometryModel(const Camera& camera1, |
| 79 | const Camera& camera2, |
| 80 | const Rigid3d& cam2_from_cam1, |
| 81 | TwoViewGeometry* two_view_geometry) { |
| 82 | two_view_geometry->E = EssentialMatrixFromPose(cam2_from_cam1); |
| 83 | if (camera1.IsSpherical() || camera2.IsSpherical()) { |
| 84 | // Omnidirectional cameras (e.g. EQUIRECTANGULAR) have no pinhole |
| 85 | // calibration matrix, so the fundamental matrix is undefined; they are |
| 86 | // always calibrated and use the bearing-based essential-matrix |
| 87 | // configuration. |
| 88 | two_view_geometry->config = TwoViewGeometry::CALIBRATED; |
| 89 | return; |
| 90 | } |
| 91 | const bool is_calibrated = |
| 92 | camera1.has_prior_focal_length && camera2.has_prior_focal_length; |
| 93 | two_view_geometry->config = is_calibrated ? TwoViewGeometry::CALIBRATED |
| 94 | : TwoViewGeometry::UNCALIBRATED; |
| 95 | two_view_geometry->F = |
| 96 | FundamentalFromEssentialMatrix(camera2.CalibrationMatrix(), |
| 97 | *two_view_geometry->E, |
| 98 | camera1.CalibrationMatrix()); |
| 99 | } |
| 100 | |
| 101 | TwoViewGeometry BuildTwoViewGeometry(bool has_relative_pose, |
| 102 | const Reconstruction& reconstruction, |
no test coverage detected