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

Method ExifCameraModel

src/colmap/sensor/bitmap.cc:304–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304std::optional<std::string> Bitmap::ExifCameraModel() const {
305 // Read camera make and model
306 const std::optional<std::string> make_str = GetMetaData("Make");
307 if (!make_str.has_value()) {
308 return std::nullopt;
309 }
310 const std::optional<std::string> model_str = GetMetaData("Model");
311 if (!model_str.has_value()) {
312 return std::nullopt;
313 }
314 float focal_length = 0;
315 if (!GetMetaData("Exif:FocalLengthIn35mmFilm", "float", &focal_length) &&
316 !GetMetaData("Exif:FocalLength", "float", &focal_length)) {
317 return std::nullopt;
318 }
319 std::string camera_model = StringPrintf("%s-%s-%.6f-%dx%d",
320 make_str->c_str(),
321 model_str->c_str(),
322 static_cast<double>(focal_length),
323 width_,
324 height_);
325 return camera_model;
326}
327
328std::optional<double> Bitmap::ExifFocalLength() const {
329 const double max_size = std::max(width_, height_);

Callers 2

NextMethod · 0.80
TESTFunction · 0.80

Calls 1

StringPrintfFunction · 0.85

Tested by 1

TESTFunction · 0.64