MCPcopy Create free account
hub / github.com/TheMariday/marimapper / COLMAPDatabase

Class COLMAPDatabase

marimapper/pycolmap_tools/database.py:145–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143
144
145class COLMAPDatabase(sqlite3.Connection):
146 @staticmethod
147 def connect(database_path):
148 return sqlite3.connect(database_path, factory=COLMAPDatabase)
149
150 def __init__(self, *args, **kwargs):
151 super(COLMAPDatabase, self).__init__(*args, **kwargs)
152
153 self.create_tables = lambda: self.executescript(CREATE_ALL)
154 self.create_cameras_table = lambda: self.executescript(
155 CREATE_CAMERAS_TABLE
156 )
157 self.create_descriptors_table = lambda: self.executescript(
158 CREATE_DESCRIPTORS_TABLE
159 )
160 self.create_images_table = lambda: self.executescript(
161 CREATE_IMAGES_TABLE
162 )
163 self.create_two_view_geometries_table = lambda: self.executescript(
164 CREATE_TWO_VIEW_GEOMETRIES_TABLE
165 )
166 self.create_keypoints_table = lambda: self.executescript(
167 CREATE_KEYPOINTS_TABLE
168 )
169 self.create_matches_table = lambda: self.executescript(
170 CREATE_MATCHES_TABLE
171 )
172 self.create_name_index = lambda: self.executescript(CREATE_NAME_INDEX)
173
174 def add_camera(
175 self,
176 model,
177 width,
178 height,
179 params,
180 prior_focal_length=False,
181 camera_id=None,
182 ):
183 params = np.asarray(params, np.float64)
184 cursor = self.execute(
185 "INSERT INTO cameras VALUES (?, ?, ?, ?, ?, ?)",
186 (
187 camera_id,
188 model,
189 width,
190 height,
191 array_to_blob(params),
192 prior_focal_length,
193 ),
194 )
195 return cursor.lastrowid
196
197 def add_image(
198 self,
199 name,
200 camera_id,
201 prior_q=np.full(4, np.nan),
202 prior_t=np.full(3, np.nan),

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected