MCPcopy
hub / github.com/cvg/Hierarchical-Localization / add_two_view_geometry

Method add_two_view_geometry

hloc/utils/database.py:212–233  ·  view source on GitHub ↗
(self, image_id1, image_id2, matches,
                              F=np.eye(3), E=np.eye(3), H=np.eye(3),
                              qvec=np.array([1.0, 0.0, 0.0, 0.0]),
                              tvec=np.zeros(3), config=2)

Source from the content-addressed store, hash-verified

210 (pair_id,) + matches.shape + (array_to_blob(matches),))
211
212 def add_two_view_geometry(self, image_id1, image_id2, matches,
213 F=np.eye(3), E=np.eye(3), H=np.eye(3),
214 qvec=np.array([1.0, 0.0, 0.0, 0.0]),
215 tvec=np.zeros(3), config=2):
216 assert(len(matches.shape) == 2)
217 assert(matches.shape[1] == 2)
218
219 if image_id1 > image_id2:
220 matches = matches[:,::-1]
221
222 pair_id = image_ids_to_pair_id(image_id1, image_id2)
223 matches = np.asarray(matches, np.uint32)
224 F = np.asarray(F, dtype=np.float64)
225 E = np.asarray(E, dtype=np.float64)
226 H = np.asarray(H, dtype=np.float64)
227 qvec = np.asarray(qvec, dtype=np.float64)
228 tvec = np.asarray(tvec, dtype=np.float64)
229 self.execute(
230 "INSERT INTO two_view_geometries VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
231 (pair_id,) + matches.shape + (array_to_blob(matches), config,
232 array_to_blob(F), array_to_blob(E), array_to_blob(H),
233 array_to_blob(qvec), array_to_blob(tvec)))
234
235
236def example_usage():

Callers 2

import_matchesFunction · 0.80
geometric_verificationFunction · 0.80

Calls 2

image_ids_to_pair_idFunction · 0.85
array_to_blobFunction · 0.85

Tested by

no test coverage detected