| 210 | } |
| 211 | |
| 212 | std::shared_ptr<Database> CreateLegacyTestDatabase() { |
| 213 | auto database = Database::Open(kInMemorySqliteDatabasePath); |
| 214 | |
| 215 | const Camera camera = Camera::CreateFromModelId( |
| 216 | kInvalidCameraId, SimplePinholeCameraModel::model_id, 1, 1, 1); |
| 217 | const camera_t camera_id = database->WriteCamera(camera); |
| 218 | Image image1; |
| 219 | image1.SetName("image1"); |
| 220 | image1.SetCameraId(camera_id); |
| 221 | Image image2; |
| 222 | image2.SetName("image2"); |
| 223 | image2.SetCameraId(camera_id); |
| 224 | Image image3; |
| 225 | image3.SetName("image3"); |
| 226 | image3.SetCameraId(camera_id); |
| 227 | const image_t image_id1 = database->WriteImage(image1); |
| 228 | const image_t image_id2 = database->WriteImage(image2); |
| 229 | const image_t image_id3 = database->WriteImage(image3); |
| 230 | database->WriteKeypoints(image_id1, FeatureKeypoints(10)); |
| 231 | database->WriteKeypoints(image_id2, FeatureKeypoints(5)); |
| 232 | database->WriteKeypoints(image_id3, FeatureKeypoints(7)); |
| 233 | TwoViewGeometry two_view_geometry; |
| 234 | two_view_geometry.inlier_matches = {{0, 1}}; |
| 235 | two_view_geometry.config = |
| 236 | TwoViewGeometry::ConfigurationType::PLANAR_OR_PANORAMIC; |
| 237 | two_view_geometry.F = Eigen::Matrix3d::Random(); |
| 238 | two_view_geometry.E = Eigen::Matrix3d::Random(); |
| 239 | two_view_geometry.H = Eigen::Matrix3d::Random(); |
| 240 | two_view_geometry.cam2_from_cam1 = |
| 241 | Rigid3d(Eigen::Quaterniond::UnitRandom(), Eigen::Vector3d::Random()); |
| 242 | database->WriteTwoViewGeometry(image_id1, image_id2, two_view_geometry); |
| 243 | database->WriteTwoViewGeometry(image_id1, image_id3, two_view_geometry); |
| 244 | |
| 245 | return database; |
| 246 | } |
| 247 | |
| 248 | TEST(DatabaseCache, ConstructFromLegacyDatabaseWithoutRigsAndFrames) { |
| 249 | auto database = CreateLegacyTestDatabase(); |
no test coverage detected