colmap / colmap

COLMAP - Structure-from-Motion and Multi-View Stereo
https://colmap.github.io/
Other
7.43k stars 1.5k forks source link

Sparse Reconstruction Failed in a Large Dataset #1970

Closed monamourvert closed 1 year ago

monamourvert commented 1 year ago

Hi! I want to use colmap for my extracted frame from rosbag. Here I have about 2.200 images and I want to reconstruct them all. I performed hierarchical mapper for sparse reconstruction as follows:

colmap hierarchical_mapper --leaf_max_num_images 100 --Mapper.max_num_models 30 --Mapper.max_model_overlap 15 --Mapper.min_model_size 5 --database_path ~/ace_dataset_colmap/library/day/mapping/database.db --image_path ~/ace_dataset_colmap/library/day/mapping/images --output_path ~/ace_dataset_colmap/library/day/mapping/sparse

But it always turns error and it said Killed. Is there any idea why this always happened?

monamourvert commented 1 year ago

Another update. I tried to use a smaller dataset that only consist of 824 images. My hierarchical mapper command as follows:

colmap hierarchical_mapper --leaf_max_num_images 50 --Mapper.max_num_models 30 --Mapper.max_model_overlap 15 --database_path ~/ace_dataset_colmap/bunsu/mapping/database.db --image_path ~/ace_dataset_colmap/bunsu/mapping/images --output_path ~/ace_dataset_colmap/bunsu/mapping/sparse

The weird thing is, it ended up like this:

.
.
.

Elapsed time: 166.929 [minutes]

==============================================================================
Loading database
==============================================================================

Loading cameras... 851 in 0.002s
Loading matches...   4  9.460452e+05    1.05e+03    1.37e+05   5.32e+01   9.80e-01  8.10e+05        1    8.64e+00    4.64e+01
  35  8.135678e+05    1.06e+00    7.68e+09   3.36e-01   3.11e-01  3.82e+10        1    4.70e+00    2.16e+02
  14  8.109934e+05    3.31e+01    3.37e+05   1.20e+01   6.93e-01  4.92e+06        1    4.69e+00    7.53e+01
  33  3.203964e+07    5.30e+00    2.18e+02   2.02e+05   8.36e-01  1.64e+07        1    7.73e+00    2.97e+02
  36  8.135667e+05    1.13e+00    7.35e+09   3.48e-01   3.00e-01  3.59e+10        1    4.56e+00    2.21e+02
  11  1.180156e+07    1.55e-01    4.65e+02   7.55e-01   1.49e+00  1.77e+09        1    1.07e+01    1.25e+02
  14  2.747843e+07    1.01e+01    9.15e+02   9.16e+00   1.16e+00  1.46e+08        1    6.63e+00    1.39e+02
  15  1.250356e+06    1.45e-03    1.05e+02   9.23e-02   9.87e-01  9.61e+08        1    9.87e+00    1.60e+02
 79334 in 5.793s
Loading images...  15  8.109699e+05    2.35e+01    2.12e+05   8.92e+00   6.85e-01  5.19e+06        1    4.47e+00    7.97e+01
 824 in 0.231s (connected 249)
Building correspondence graph... in 1.632s (ignored 64604)

But nothing saved in sparse folder. Getting more confused. I'll appreciate if someone gives me some clues...

wesleyliwei commented 1 year ago

Another update. I tried to use a smaller dataset that only consist of 824 images. My hierarchical mapper command as follows:

colmap hierarchical_mapper --leaf_max_num_images 50 --Mapper.max_num_models 30 --Mapper.max_model_overlap 15 --database_path ~/ace_dataset_colmap/bunsu/mapping/database.db --image_path ~/ace_dataset_colmap/bunsu/mapping/images --output_path ~/ace_dataset_colmap/bunsu/mapping/sparse

The weird thing is, it ended up like this:

.
.
.

Elapsed time: 166.929 [minutes]

==============================================================================
Loading database
==============================================================================

Loading cameras... 851 in 0.002s
Loading matches...   4  9.460452e+05    1.05e+03    1.37e+05   5.32e+01   9.80e-01  8.10e+05        1    8.64e+00    4.64e+01
  35  8.135678e+05    1.06e+00    7.68e+09   3.36e-01   3.11e-01  3.82e+10        1    4.70e+00    2.16e+02
  14  8.109934e+05    3.31e+01    3.37e+05   1.20e+01   6.93e-01  4.92e+06        1    4.69e+00    7.53e+01
  33  3.203964e+07    5.30e+00    2.18e+02   2.02e+05   8.36e-01  1.64e+07        1    7.73e+00    2.97e+02
  36  8.135667e+05    1.13e+00    7.35e+09   3.48e-01   3.00e-01  3.59e+10        1    4.56e+00    2.21e+02
  11  1.180156e+07    1.55e-01    4.65e+02   7.55e-01   1.49e+00  1.77e+09        1    1.07e+01    1.25e+02
  14  2.747843e+07    1.01e+01    9.15e+02   9.16e+00   1.16e+00  1.46e+08        1    6.63e+00    1.39e+02
  15  1.250356e+06    1.45e-03    1.05e+02   9.23e-02   9.87e-01  9.61e+08        1    9.87e+00    1.60e+02
 79334 in 5.793s
Loading images...  15  8.109699e+05    2.35e+01    2.12e+05   8.92e+00   6.85e-01  5.19e+06        1    4.47e+00    7.97e+01
 824 in 0.231s (connected 249)
Building correspondence graph... in 1.632s (ignored 64604)

But nothing saved in sparse folder. Getting more confused. I'll appreciate if someone gives me some clues...

first, 824 images is a small dataset, you could first try to direct use mapper. second, the log shows the reconstruction process nothing, just load the data and return. You can check the database whether the matches are well collected.

monamourvert commented 1 year ago

Hi, thanks for your reply! I reproduce the 2.200 images dataset again with direct mapper and it worked! But I found a strange result. Is it possible if colmap fails to recognize the camera pose if our images have ambiguous feature? In my case, my dataset consist of the front, back, left and right side of the building.Those images surely have similar feature. So, when I checked the reconstruction, the result came not very good.

This is the result of fused images: meshed

And this is the result when I applied Poisson Mesher: meshedppoisoon

I also wonder why it fails when I apply the poisson mesher on it. I'll appreciate if you can enlighten me about this! Thanks!

wesleyliwei commented 1 year ago

Just part of the building was reconstructed, mainly because some view images were not registered. As you mentioned, maybe the matching is not good, cased by ambiguous features, such as repeatted appreance. You could check the matching result from the database first, I thought it's the main reason.

monamourvert commented 1 year ago

I checked the matching result and I can confirm if the problem is the matching process.

These photos are not respective frame and not in the same side of building: fail2

Is there any way to overcome this problem? I used exhaustive matching in feature matching process and after read the documentation, there also another scenarios, ie sequential matching, vocabulary tree matching, etc. But still, I wonder if they can overcome the ambiguous feature. Any suggestion?

wesleyliwei commented 1 year ago

If your frames are sequentially recorded, please try sequential matching, it will overcome your current problem, the matching pair will be from the same perspective. For vocabulary tree matching, the mather will use searching skills to fine the global similar image as matching candidate, but for your scenario, maybe the front and back of the building seems pretty simillar, it's not easy to overcome your problem.

Just some ideas, FYI, hope it helpful!

monamourvert commented 1 year ago

Thanks for your suggestion! For now, I'll close this issue~