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

Method Load

src/colmap/scene/database_cache.cc:61–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59 : correspondence_graph_(std::make_shared<class CorrespondenceGraph>()) {}
60
61void DatabaseCache::Load(const Database& database, const Options& options) {
62 const bool has_rigs = database.NumRigs() > 0;
63 const bool has_frames = database.NumFrames() > 0;
64
65 //////////////////////////////////////////////////////////////////////////////
66 // Load rigs
67 //////////////////////////////////////////////////////////////////////////////
68
69 Timer timer;
70
71 timer.Start();
72 LOG(INFO) << "Loading rigs...";
73
74 {
75 std::vector<class Rig> rigs = database.ReadAllRigs();
76 rigs_.reserve(rigs.size());
77 for (auto& rig : rigs) {
78 rigs_.emplace(rig.RigId(), std::move(rig));
79 }
80 }
81
82 LOG(INFO) << StringPrintf(
83 " %d in %.3fs", rigs_.size(), timer.ElapsedSeconds());
84
85 //////////////////////////////////////////////////////////////////////////////
86 // Load cameras
87 //////////////////////////////////////////////////////////////////////////////
88
89 timer.Restart();
90 LOG(INFO) << "Loading cameras...";
91
92 {
93 std::vector<struct Camera> cameras = database.ReadAllCameras();
94 cameras_.reserve(cameras.size());
95 for (auto& camera : cameras) {
96 if (!has_rigs) {
97 // For backwards compatibility with old databases from before having
98 // support for rigs/frames, we create a rig for each camera.
99 class Rig rig;
100 rig.SetRigId(camera.camera_id);
101 rig.AddRefSensor(camera.SensorId());
102 rigs_.emplace(rig.RigId(), std::move(rig));
103 }
104 cameras_.emplace(camera.camera_id, std::move(camera));
105 }
106 }
107
108 LOG(INFO) << StringPrintf(
109 " %d in %.3fs", cameras_.size(), timer.ElapsedSeconds());
110
111 //////////////////////////////////////////////////////////////////////////////
112 // Load frames
113 //////////////////////////////////////////////////////////////////////////////
114
115 timer.Restart();
116 LOG(INFO) << "Loading frames...";
117
118 {

Callers 1

CreateMethod · 0.45

Calls 15

StringPrintfFunction · 0.85
UseInlierMatchesCheckFunction · 0.85
PairIdToImagePairFunction · 0.85
sizeMethod · 0.80
ElapsedSecondsMethod · 0.80
RestartMethod · 0.80
AddRefSensorMethod · 0.80
SensorIdMethod · 0.80
HasFrameIdMethod · 0.80
ImageIdMethod · 0.80
CameraIdMethod · 0.80
AddDataIdMethod · 0.80

Tested by

no test coverage detected