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

Function ReadDatabaseCameraLocations

src/colmap/exe/model.cc:149–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149void 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
179void WriteComparisonErrorsCSV(const std::filesystem::path& path,
180 const std::vector<ImageAlignmentError>& errors) {

Callers 1

RunModelAlignerFunction · 0.85

Calls 5

ConvertCameraLocationsFunction · 0.85
DataIdMethod · 0.80
ReadAllPosePriorsMethod · 0.45
ReadAllImagesMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected