| 31 | } |
| 32 | |
| 33 | SceneData::SceneData(std::string scene_path) : scene_path(scene_path) |
| 34 | { |
| 35 | scene_name = std::filesystem::path(scene_path).filename(); |
| 36 | std::cout << "====================================" << std::endl; |
| 37 | std::cout << "Scene Loaded" << std::endl; |
| 38 | std::cout << " Name " << scene_name << std::endl; |
| 39 | std::cout << " Path " << scene_path << std::endl; |
| 40 | SAIGA_ASSERT(std::filesystem::exists(scene_path)); |
| 41 | |
| 42 | { |
| 43 | std::string file_ini = scene_path + "/dataset.ini"; |
| 44 | SAIGA_ASSERT(std::filesystem::exists(file_ini)); |
| 45 | dataset_params = SceneDatasetParams(file_ini); |
| 46 | } |
| 47 | |
| 48 | for (auto ini_file : dataset_params.camera_files) |
| 49 | { |
| 50 | std::string file_ini = scene_path + "/" + ini_file; |
| 51 | SAIGA_ASSERT(std::filesystem::exists(file_ini)); |
| 52 | scene_cameras.push_back(SceneCameraParams(file_ini)); |
| 53 | } |
| 54 | SAIGA_ASSERT(!scene_cameras.empty()); |
| 55 | |
| 56 | file_dataset_base = scene_path; |
| 57 | file_intrinsics = scene_path + "/intrinsics/intrinsic_color.txt"; |
| 58 | file_point_cloud = scene_path + "/" + dataset_params.file_point_cloud; |
| 59 | file_point_cloud_compressed = scene_path + "/" + dataset_params.file_point_cloud_compressed; |
| 60 | file_pose = scene_path + "/poses.txt"; |
| 61 | file_exposure = scene_path + "/exposure.txt"; |
| 62 | file_white_balance = scene_path + "/white_balance.txt"; |
| 63 | file_image_names = scene_path + "/images.txt"; |
| 64 | file_mask_names = scene_path + "/masks.txt"; |
| 65 | file_camera_indices = scene_path + "/camera_indices.txt"; |
| 66 | |
| 67 | if (std::filesystem::exists(file_point_cloud_compressed)) |
| 68 | { |
| 69 | point_cloud.LoadCompressed(file_point_cloud_compressed); |
| 70 | } |
| 71 | else if (std::filesystem::exists(file_point_cloud)) |
| 72 | { |
| 73 | std::cout << ">> Loading initial PLY point cloud and preprocessing it (done only once)" << std::endl; |
| 74 | point_cloud = Saiga::UnifiedModel(file_point_cloud).mesh[0]; |
| 75 | |
| 76 | // some initial processing |
| 77 | point_cloud.RemoveDoubles(0.0001); |
| 78 | RemoveLonelyPoints(5, 0.02); |
| 79 | RemoveClosePoints(0.00005); |
| 80 | point_cloud.ReorderMorton64(); |
| 81 | point_cloud.RandomBlockShuffle(256); |
| 82 | ComputeRadius(); |
| 83 | SortBlocksByRadius(256); |
| 84 | |
| 85 | |
| 86 | std::cout << "Save point cloud " << file_point_cloud_compressed << std::endl; |
| 87 | point_cloud.SaveCompressed(file_point_cloud_compressed); |
| 88 | |
| 89 | UnifiedModel(point_cloud).Save(scene_path + "/point_cloud_initial_preprocess.ply"); |
| 90 | } |
nothing calls this directly
no test coverage detected