colmap / pycolmap

Python bindings for COLMAP
BSD 3-Clause "New" or "Revised" License
858 stars 125 forks source link

using pycolmap align two scene But either the exact same image is not captured (no overlapping images), or only part of the images overlap #271

Open Bin-ze opened 2 months ago

Bin-ze commented 2 months ago

when run:

rec2_from_rec1 = pycolmap.align_reconstructions_via_reprojections(reconstruction_1, reconstruction_2)
reconstruction_1.transform(rec2_from_rec1)
print(rec2_from_rec1.scale, rec2_from_rec1.rotation, rec2_from_rec1.translation)

only reconstruction_1 and reconstruction_2 have same images work, other time:

In [4]: pycolmap.align_reconstructions_via_reprojections(reconstruction_1, reconstruction_2)
F20240407 16:35:44.643065 32617 alignment.cc:77] Check failed: src_images[i]->ImageId() == tgt_images[i]->ImageId() (87 vs. 17) 
*** Check failure stack trace: ***
    @     0x7fa26267fdff  (unknown)
    @     0x7fa26267c4e2  (unknown)
    @     0x7fa262680769  (unknown)
    @     0x7fa2627f01e1  (unknown)
    @     0x7fa2627f11c6  colmap::AlignReconstructionsViaReprojections()
    @     0x7fa26257b435  (unknown)
    @     0x7fa2624e18f1  (unknown)
    @     0x560a781dd6b6  cfunction_call
    @     0x560a781c67ac  _PyObject_MakeTpCall
    @     0x560a781c2f10  _PyEval_EvalFrameDefault
    @     0x560a781bd184  _PyEval_EvalCode
    @     0x560a781bce58  _PyEval_EvalCodeWithName
    @     0x560a781bce09  PyEval_EvalCodeEx
    @     0x560a7826a4ab  PyEval_EvalCode
    @     0x560a7826efa2  builtin_exec
    @     0x560a781cef63  cfunction_vectorcall_FASTCALL
    @     0x560a781be352  _PyEval_EvalFrameDefault
    @     0x560a782718a2  gen_send_ex
    @     0x560a781c4380  _PyEval_EvalFrameDefault
    @     0x560a782718a2  gen_send_ex
    @     0x560a781c4380  _PyEval_EvalFrameDefault
    @     0x560a782718a2  gen_send_ex
    @     0x560a781d9ffc  method_vectorcall_O
    @     0x560a781be606  _PyEval_EvalFrameDefault
    @     0x560a781ce802  function_code_fastcall
    @     0x560a781be352  _PyEval_EvalFrameDefault
    @     0x560a781ce802  function_code_fastcall
    @     0x560a781be606  _PyEval_EvalFrameDefault
    @     0x560a781bd184  _PyEval_EvalCode
    @     0x560a781db9fb  method_vectorcall
    @     0x560a781bf162  _PyEval_EvalFrameDefault
    @     0x560a781ce802  function_code_fastcall
Aborted (core dumped)