This repo contains the official implementation of our CVPR 2021 paper - Hybrid Rotation Averaging: A Fast and Robust Rotation Averaging Approach. This library contains not only rotation averaging solvers, but also some popular methods in 3D vision, such as translation averaging, clustering, etc. The library is designed to deal with large scale optimization problems, and is easy to extend. Feel free to contribute to this project.
- A library which solves the optimization problems in 3D vision.
- A template-based graph module which is easy to extend and to manipulate graph structures.
- Rotation averaging solvers achieves state-of-the-art.
- Translation averaging solvers (LUD, LiGT, BATA).
- Global SfM pipeline
The library is compiled and tested on Ubuntu 16.04/18.04/20.04. We would like to support more platforms in the future.
This project requires Eigen 3.2. And Ceres 1.14.0 is currently used for nonlinear optimization. You can install all the dependencies through the ./scripts/dependencies.sh
.
bash ./scripts/dependencies.sh
Follow build.sh or execute the command below:
git clone https://github.com/AIBluefisher/GraphOptim.git
cd GraphOptim
mkdir build && cd build
cmake ..
make -j8
sudo make install
Once we installed GraphOptim, we can use it as an external library. And also, we can try the provided global SfM application.
At first, try to install my folk of COLMAP. Then main difference between this folk and COLMAP is that my folk stores relative poses into the database while COLMAP does not.
# COLMAP dependencies
sudo apt-get install \
git \
cmake \
build-essential \
libboost-program-options-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-regex-dev \
libboost-system-dev \
libboost-test-dev \
libeigen3-dev \
libsuitesparse-dev \
libfreeimage-dev \
libgoogle-glog-dev \
libgflags-dev \
libglew-dev \
qtbase5-dev \
libqt5opengl5-dev \
libcgal-dev \
libcgal-qt5-dev
# ceres-solver
sudo apt-get install libatlas-base-dev libsuitesparse-dev
git clone https://ceres-solver.googlesource.com/ceres-solver
cd ceres-solver
git checkout $(git describe --tags) # Checkout the latest release
mkdir build
cd build
cmake .. -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF
make
sudo make install
git clone https://github.com/AIBluefisher/colmap
cd colmap
mkdir build && cd build
cmake .. && make -j8
sudo make install
Then, we can build GlobalSfM pipeline by checking into the applications subfolder:
cd applications
mkdir build && cd build
cmake ..
make -j8
./build/bin/rotation_estimator --g2o_filename=./data/synthetic/20_2.g2o
You can also try other g2o
files.
The translation averaging methods are decoupled from another project.
./build/bin/position_estimator --g2o_filename=./data/synthetic/20_2.g2o
COLMAP provides only incremental Structure-from-Motion pipelines. To mitigate this issue, we implement a global SfM pipeline based on TheiaSfM. The implementation can provide a fair comparison to other methods, since most work uses COLMAP's keypoints and feature matcher while TheiaSfM uses different keypoints extraction and matching method, which is not suitable to do a fair comparison.
./applications/run_global_sfm.sh $DATASET_PATH $OUTPUT_PATH $VOC_TREE_PATH $MOST_SIMILAR_IMAGES_NUM
You may also want to try different rotation averaging and translation averaging solvers by setting (just appending the parameters at the end of your command):
ROTATION_ESTIMATOR_TYPE
: [ROBUST_L1L2, HYBRID]POSITION_ESTIMATOR_TYPE
: [LUD, LIGT]
It is recommended to use LIGT as the translation averaging solver, as it performs always better than LUD in the test. Tests are based on the dataset collected by Olsson:
GraphOptim also supports to generate a synthesized dataset to train SOTA pose synchronization models. Implementation is adapted from NeuRoRa's matlab code.
./build/bin/view_graph_synthesizer \
--num_threads=8 \
--num_scenes=1250 \
--output_dir=./
find_package(Gopt REQUIRED)
if(GOPT_FOUND)
message(STATUS "Found GOPT_INCLUDE_DIRs ${GOPT_INCLUDE_DIRS}")
message(STATUS "Found GOPT_LINK_DIRs ${GOPT_LINK_DIRS}")
message(STATUS "Found GOPT_LIBRARIES ${GOPT_LIBRARIES}")
else(GOPT_FOUND)
message(FATAL "GOPT not found!")
endif(GOPT_FOUND)
include_directories(${GOPT_INCLUDE_DIRS})
link_directories(${GOPT_LINK_DIRS})
add_library(${YOUR_LIB} *.h *.cc)
target_link_libraries(${YOUR_LIB} ${GOPT_LIBRARIES})
add_executable(${YOUR_EXE} *.h *.cc)
target_link_libraries(${YOUR_EXE} ${GOPT_LIBRARIES})
If you find the code useful for your research, please consider cite our paper:
@inproceedings{DBLP:conf/cvpr/Chen0K21,
author = {Yu Chen and
Ji Zhao and
Laurent Kneip},
title = {Hybrid Rotation Averaging: {A} Fast and Robust Rotation Averaging
Approach},
booktitle = {{IEEE} Conference on Computer Vision and Pattern Recognition},
pages = {10358--10367},
year = {2021}
}