| 147 | } |
| 148 | |
| 149 | void ReadDatabaseCameraLocations(const std::filesystem::path& database_path, |
| 150 | const bool ref_is_gps, |
| 151 | const std::string& alignment_type, |
| 152 | std::vector<std::string>* ref_image_names, |
| 153 | std::vector<Eigen::Vector3d>* ref_locations) { |
| 154 | auto database = Database::Open(database_path); |
| 155 | |
| 156 | // Index pose priors by their associated data ID. |
| 157 | std::unordered_map<data_t, PosePrior> pose_priors_by_data_id; |
| 158 | for (const auto& pose_prior : database->ReadAllPosePriors()) { |
| 159 | pose_priors_by_data_id.emplace(pose_prior.corr_data_id, pose_prior); |
| 160 | } |
| 161 | |
| 162 | for (const auto& image : database->ReadAllImages()) { |
| 163 | const auto it = pose_priors_by_data_id.find(image.DataId()); |
| 164 | if (it != pose_priors_by_data_id.end()) { |
| 165 | ref_image_names->push_back(image.Name()); |
| 166 | const auto& pose_prior = it->second; |
| 167 | if (ref_is_gps) { |
| 168 | THROW_CHECK_EQ(static_cast<int>(pose_prior.coordinate_system), |
| 169 | static_cast<int>(PosePrior::CoordinateSystem::WGS84)); |
| 170 | } |
| 171 | ref_locations->push_back(pose_prior.position); |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | *ref_locations = |
| 176 | ConvertCameraLocations(ref_is_gps, alignment_type, *ref_locations); |
| 177 | } |
| 178 | |
| 179 | void WriteComparisonErrorsCSV(const std::filesystem::path& path, |
| 180 | const std::vector<ImageAlignmentError>& errors) { |
no test coverage detected