MCPcopy Create free account
hub / github.com/colmap/colmap / ReadTwoViewGeometries

Method ReadTwoViewGeometries

src/colmap/scene/database_sqlite.cc:1009–1083  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1007 }
1008
1009 std::vector<std::pair<image_pair_t, TwoViewGeometry>> ReadTwoViewGeometries()
1010 const override {
1011 Sqlite3StmtContext context(sql_stmt_read_two_view_geometries_);
1012
1013 std::vector<std::pair<image_pair_t, TwoViewGeometry>>
1014 all_two_view_geometries;
1015
1016 int rc;
1017 while ((rc = SQLITE3_CALL(sqlite3_step(
1018 sql_stmt_read_two_view_geometries_))) == SQLITE_ROW) {
1019 const image_pair_t pair_id = static_cast<image_pair_t>(
1020 sqlite3_column_int64(sql_stmt_read_two_view_geometries_, 0));
1021
1022 TwoViewGeometry two_view_geometry;
1023
1024 const FeatureMatchesBlob blob = ReadDynamicMatrixBlob<FeatureMatchesBlob>(
1025 sql_stmt_read_two_view_geometries_, rc, 1);
1026 two_view_geometry.inlier_matches = FeatureMatchesFromBlob(blob);
1027
1028 two_view_geometry.config = static_cast<int>(
1029 sqlite3_column_int64(sql_stmt_read_two_view_geometries_, 4));
1030
1031 // Read matrix data if present (NULL means not set).
1032 if (sqlite3_column_type(sql_stmt_read_two_view_geometries_, 5) !=
1033 SQLITE_NULL) {
1034 two_view_geometry.F = ReadStaticMatrixBlob<Eigen::Matrix3d>(
1035 sql_stmt_read_two_view_geometries_, rc, 5);
1036 }
1037 if (sqlite3_column_type(sql_stmt_read_two_view_geometries_, 6) !=
1038 SQLITE_NULL) {
1039 two_view_geometry.E = ReadStaticMatrixBlob<Eigen::Matrix3d>(
1040 sql_stmt_read_two_view_geometries_, rc, 6);
1041 }
1042 if (sqlite3_column_type(sql_stmt_read_two_view_geometries_, 7) !=
1043 SQLITE_NULL) {
1044 two_view_geometry.H = ReadStaticMatrixBlob<Eigen::Matrix3d>(
1045 sql_stmt_read_two_view_geometries_, rc, 7);
1046 }
1047
1048 // Read the pose data if present (NULL means not set).
1049 const bool has_qvec =
1050 sqlite3_column_type(sql_stmt_read_two_view_geometries_, 8) !=
1051 SQLITE_NULL;
1052 const bool has_tvec =
1053 sqlite3_column_type(sql_stmt_read_two_view_geometries_, 9) !=
1054 SQLITE_NULL;
1055 THROW_CHECK_EQ(has_qvec, has_tvec)
1056 << "qvec and tvec must both be NULL or both be non-NULL";
1057 if (has_qvec) {
1058 const Eigen::Vector4d quat_wxyz = ReadStaticMatrixBlob<Eigen::Vector4d>(
1059 sql_stmt_read_two_view_geometries_, rc, 8);
1060 Rigid3d cam2_from_cam1;
1061 cam2_from_cam1.rotation() = Eigen::Quaterniond(
1062 quat_wxyz(0), quat_wxyz(1), quat_wxyz(2), quat_wxyz(3));
1063 cam2_from_cam1.translation() = ReadStaticMatrixBlob<Eigen::Vector3d>(
1064 sql_stmt_read_two_view_geometries_, rc, 9);
1065 two_view_geometry.cam2_from_cam1 = cam2_from_cam1;
1066 }

Callers 11

TEST_PFunction · 0.45
TESTFunction · 0.45
MergeMethod · 0.45
LoadMethod · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
CalibrateViewGraphFunction · 0.45

Calls 3

FeatureMatchesFromBlobFunction · 0.85
rotationMethod · 0.45
translationMethod · 0.45

Tested by 8

TEST_PFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36