cvg / pixel-perfect-sfm

Pixel-Perfect Structure-from-Motion with Featuremetric Refinement (ICCV 2021, Best Student Paper Award)
Apache License 2.0
1.34k stars 139 forks source link

Update to COLMAP 3.9 #138

Open Dawars opened 8 months ago

Dawars commented 8 months ago

Updating to work with colmap 3.9+ according to #110

I managed to compile the code but it still doesn't link.

Todo:

I had to add a print function for CameraModelId because apparently enums cannot be easily printed: std::ostream& operator<<(std::ostream& os, const colmap::CameraModelId& id) Probably there is a really easy fix for this though.

Details

Linking CXX shared module ../../lib.linux-x86_64-3.10/pixsfm/_pixsfm.cpython-310-x86_64-linux-gnu.so /usr/bin/ld: libpixsfm.a(graph.cc.o): in function `operator<<(std::ostream&, colmap::CameraModelId const&)': graph.cc:(.text+0x11c0): multiple definition of `operator<<(std::ostream&, colmap::CameraModelId const&)'; CMakeFiles/_pixsfm.dir/_pixsfm/bindings.cc.o (symbol from plugin):(.text+0x0): first defined here /usr/bin/ld: libpixsfm.a(featurepatch.cc.o): in function `operator<<(std::ostream&, colmap::CameraModelId const&)': featurepatch.cc:(.text+0x760): multiple definition of `operator<<(std::ostream&, colmap::CameraModelId const&)'; CMakeFiles/_pixsfm.dir/_pixsfm/bindings.cc.o (symbol from plugin):(.text+0x0): first defined here /usr/bin/ld: libpixsfm.a(featuremap.cc.o): in function `operator<<(std::ostream&, colmap::CameraModelId const&)': featuremap.cc:(.text+0x8a0): multiple definition of `operator<<(std::ostream&, colmap::CameraModelId const&)'; CMakeFiles/_pixsfm.dir/_pixsfm/bindings.cc.o (symbol from plugin):(.text+0x0): first defined here /usr/bin/ld: libpixsfm.a(featuremanager.cc.o): in function `operator<<(std::ostream&, colmap::CameraModelId const&)': featuremanager.cc:(.text+0xe0): multiple definition of `operator<<(std::ostream&, colmap::CameraModelId const&)'; CMakeFiles/_pixsfm.dir/_pixsfm/bindings.cc.o (symbol from plugin):(.text+0x0): first defined here /usr/bin/ld: libpixsfm.a(featureview.cc.o): in function `operator<<(std::ostream&, colmap::CameraModelId const&)': featureview.cc:(.text+0x690): multiple definition of `operator<<(std::ostream&, colmap::CameraModelId const&)'; CMakeFiles/_pixsfm.dir/_pixsfm/bindings.cc.o (symbol from plugin):(.text+0x0): first defined here /usr/bin/ld: libpixsfm.a(featureset.cc.o): in function `operator<<(std::ostream&, colmap::CameraModelId const&)': featureset.cc:(.text+0xc00): multiple definition of `operator<<(std::ostream&, colmap::CameraModelId const&)'; CMakeFiles/_pixsfm.dir/_pixsfm/bindings.cc.o (symbol from plugin):(.text+0x0): first defined here /usr/bin/ld: libpixsfm.a(references.cc.o): in function `operator<<(std::ostream&, colmap::CameraModelId const&)': references.cc:(.text+0x340): multiple definition of `operator<<(std::ostream&, colmap::CameraModelId const&)'; CMakeFiles/_pixsfm.dir/_pixsfm/bindings.cc.o (symbol from plugin):(.text+0x0): first defined here /usr/bin/ld: libpixsfm.a(keypoint_adjustment_options.cc.o): in function `operator<<(std::ostream&, colmap::CameraModelId const&)': keypoint_adjustment_options.cc:(.text+0x0): multiple definition of `operator<<(std::ostream&, colmap::CameraModelId const&)'; CMakeFiles/_pixsfm.dir/_pixsfm/bindings.cc.o (symbol from plugin):(.text+0x0): first defined here /usr/bin/ld: libpixsfm.a(bundle_adjustment_options.cc.o): in function `operator<<(std::ostream&, colmap::CameraModelId const&)': bundle_adjustment_options.cc:(.text+0x0): multiple definition of `operator<<(std::ostream&, colmap::CameraModelId const&)'; CMakeFiles/_pixsfm.dir/_pixsfm/bindings.cc.o (symbol from plugin):(.text+0x0): first defined here

I don't want to spend more time on figuring these out in the near future but I'm happy to address any reviews.

zhj296409022 commented 3 months ago

FAILED: pixsfm/base/irls_optim_test : && /usr/bin/x86_64-linux-gnu-g++ -fvisibility=hidden -fPIC -std=c++14 -mavx2 -mf16c -mfma -DEIGEN_MAX_ALIGN_BYTES=16 -DEIGEN_MAX_STATIC_ALIGN_BYTES=16 -DEIGEN_DONT_VECTORIZE -O3 -DNDEBUG -rdynamic pixsfm/base/CMakeFiles/irls_optim_test.dir/src/irls_optim_test.cc.o -o pixsfm/base/irls_optim_test -Wl,-rpath,/usr/lib/x86_64-linux-gnu/hdf5/serial pixsfm/libpixsfm.a /usr/local/lib/libgtest.a /usr/local/lib/libgtest_main.a /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so -lcrypto -lcurl -Wl,-Bstatic -lpthread -Wl,-Bdynamic -lsz -lz -Wl,-Bstatic -ldl -Wl,-Bdynamic -lm -lpython3.10 /usr/lib/libceres.so.2.0.0 /usr/lib/x86_64-linux-gnu/libglog.so.0.4.0 -lunwind /usr/lib/x86_64-linux-gnu/libgflags.so.2.2.2 -lpthread -lfreeimage /usr/local/lib/libgtest.a && : /usr/bin/ld: pixsfm/base/CMakeFiles/irls_optim_test.dir/src/irls_optim_test.cc.o: in functionvoid pixsfm::TestSimilarity<3>(int, pixsfm::InterpolationConfig)': irls_optim_test.cc:(.text._ZN6pixsfm14TestSimilarityILi3EEEviNS_19InterpolationConfigE[_ZN6pixsfm14TestSimilarityILi3EEEviNS_19InterpolationConfigE]+0x326): undefined reference to colmap::Timer::Timer()' /usr/bin/ld: irls_optim_test.cc:(.text._ZN6pixsfm14TestSimilarityILi3EEEviNS_19InterpolationConfigE[_ZN6pixsfm14TestSimilarityILi3EEEviNS_19InterpolationConfigE]+0x343): undefined reference tocolmap::Timer::Start()' /usr/bin/ld: irls_optim_test.cc:(.text._ZN6pixsfm14TestSimilarityILi3EEEviNS_19InterpolationConfigE[_ZN6pixsfm14TestSimilarityILi3EEEviNS_19InterpolationConfigE]+0x372): undefined reference to colmap::Timer::PrintSeconds() const' /usr/bin/ld: irls_optim_test.cc:(.text._ZN6pixsfm14TestSimilarityILi3EEEviNS_19InterpolationConfigE[_ZN6pixsfm14TestSimilarityILi3EEEviNS_19InterpolationConfigE]+0x37a): undefined reference tocolmap::Timer::Restart()' /usr/bin/ld: irls_optim_test.cc:(.text._ZN6pixsfm14TestSimilarityILi3EEEviNS_19InterpolationConfigE[_ZN6pixsfm14TestSimilarityILi3EEEviNS_19InterpolationConfigE]+0x82e): undefined reference to colmap::Timer::PrintSeconds() const' /usr/bin/ld: pixsfm/base/CMakeFiles/irls_optim_test.dir/src/irls_optim_test.cc.o: in functionvoid pixsfm::TestSimilarity<128>(int, pixsfm::InterpolationConfig)': irls_optim_test.cc:(.text._ZN6pixsfm14TestSimilarityILi128EEEviNS_19InterpolationConfigE[_ZN6pixsfm14TestSimilarityILi128EEEviNS_19InterpolationConfigE]+0x381): undefined reference to colmap::Timer::Timer()' /usr/bin/ld: irls_optim_test.cc:(.text._ZN6pixsfm14TestSimilarityILi128EEEviNS_19InterpolationConfigE[_ZN6pixsfm14TestSimilarityILi128EEEviNS_19InterpolationConfigE]+0x39e): undefined reference tocolmap::Timer::Start()' /usr/bin/ld: irls_optim_test.cc:(.text._ZN6pixsfm14TestSimilarityILi128EEEviNS_19InterpolationConfigE[_ZN6pixsfm14TestSimilarityILi128EEEviNS_19InterpolationConfigE]+0x3cd): undefined reference to colmap::Timer::PrintSeconds() const' /usr/bin/ld: irls_optim_test.cc:(.text._ZN6pixsfm14TestSimilarityILi128EEEviNS_19InterpolationConfigE[_ZN6pixsfm14TestSimilarityILi128EEEviNS_19InterpolationConfigE]+0x3d5): undefined reference tocolmap::Timer::Restart()' /usr/bin/ld: irls_optim_test.cc:(.text._ZN6pixsfm14TestSimilarityILi128EEEviNS_19InterpolationConfigE[_ZN6pixsfm14TestSimilarityILi128EEEviNS_19InterpolationConfigE]+0x9f3): undefined reference to colmap::Timer::PrintSeconds() const' collect2: error: ld returned 1 exit status

Dawars commented 3 months ago

Thanks for looking into it.

How did you try to build it? Cmake or pip?

The Timer should still be in colmap https://github.com/colmap/colmap/blob/main/src/colmap/util/timer.cc#L80 I had the same problem but as far as I can tell this only effects tests.

zhj296409022 commented 2 months ago

When using both CMake and pip, I encounter this issue. If I disable TESTS_ENABLED, the compilation can pass, but it seems that no content is compiled under pixsfm._pixsfm directory.

Dawars commented 2 months ago

I used something like:

pip install . --config-settings=cmake.define.CMAKE_PREFIX_PATH="/opt/conda/lib;/opt/conda/include;/opt/conda/"

It worked for me but I have problems with multiple versions of some libs (gomp).

Here is my Dockerfile for reference: https://github.com/Dawars/docker_files/blob/main/Dockerfile.colmap#L103

johnnynunez commented 2 months ago

how is it going? Colmap 3.10 is out @Dawars