-
Notifications
You must be signed in to change notification settings - Fork 120
Build Instructions
Our lab's development environment is Ubuntu 20.04 and gcc9. We also support whatever environments the developers feel like supporting (currently Arch Linux and Mac OS).
In the below instructions XIVO_ROOT
is the location that XIVO is cloned to.
(list may be incomplete)
Ubuntu:
sudo apt-get install cmake libpython-dev libsuitesparse-dev libgflags-dev libgoogle-glog-dev libgl1-mesa-dev libglew-dev libfmt-dev
Arch Linux:
sudo pacman -S cmake blas cblas glew fmt
Next (for Arch Linux only), compile gflags and glog. We will need to link OpenCV against it instead of using a separate system-wide installation of gflags and glog.
cd $XIVO_ROOT
./build_arch0.sh
$ git clone https://github.com/opencv/opencv.git
$ cd opencv
$ git checkout 3.4
$ cd ..
$ git clone https://github.com/opencv/opencv_contrib.git
$ cd opencv_contrib
$ git checkout 3.4
$ cd ../opencv
$ mkdir build && cd build
The default value of $OPENCV_INSTALL_LOCATION
is /usr/local
. This is not desirable since it may interfere with other programs; we recommend installing OpenCV for XIVO in a separate location.
Ubuntu:
$ cmake .. \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=$OPENCV_INSTALL_LOCATION \
-D ENABLE_FAST_MATH=1 \
-D CUDA_FAST_MATH=1 \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
Arch Linux:
First, add the following line at line 33 of /path/to/opencv/src/modules/core/CMakeLists.txt
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=address")
Next, added the following lines right after line 5 of /path/to/opencv_contrib/src/modules/sfm/CMakeLists.txt
. (Either export XIVO_ROOT
as an environment variable or replace XIVO_ROOT
with the absolute path in the lines below.
set(Glog_DIR "${XIVO_ROOT}/thirdparty/glog/lib/cmake/glog")
set(Gflags_DIR "${XIVO_ROOT}/thirdparty/gflags/lib/cmake/gflags")
Then, run:
$ cmake .. \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/home/stephanie/DevelopmentEnvironments/xivo \
-D ENABLE_FAST_MATH=1 \
-D CUDA_FAST_MATH=1 \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-D CMAKE_EXE_LINKER_FLAGS=-lcblas \
-D CMAKE_SHARED_LINKER_FLAGS=-lcblas \
-D WITH_FFMPEG=OFF \
-D BUILD_EXAMPLES=OFF \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D CMAKE_DISABLE_FIND_PACKAGE_Ceres=ON \
-D Glog_DIR=/path/to/xivo/thirdparty/glog/lib/cmake/glog \
-D Gflags_DIR=/path/to/xivo/thirdparty/gflags/lib/cmake/gflags
Mac OS:
[fill this in later]
$ make -j $CPU_COUNT
$ make install
In CMakeLists.txt
:
- Set
CMAKE_BUILD_TYPE
to "Debug", "RelWithDebInfo", or "Release". (Default="Release") - (Optional) Comment-out
add_definitions(-DGOOGLE_STRIP_LOG=1)
to enable logging
In src/CMakeLists.txt
, comment or uncomment the following lines. (comment=false, uncomment=true)
add_definitions(-DUSE_INVDEPTH)
add_definitions(-DUSE_ONLINE_IMU_CALIB)
add_definitions(-DUSE_ONLINE_TEMPORAL_CALIB)
add_definitions(-DUSE_ONLINE_CAMERA_CALIB)
add_definitions(-DUSE_MAPPER)
In src/CMakeLists.txt
, set values on the following lines. Leave lines commented to use the default values in src/core.h
:
-
add_definitions(-DEKF_MAX_FEATURES=30)
-- maximum number of features tracked in the EKF -
add_definitions(-DEKF_MAX_GROUPS=15)
-- maximum number of groups tracked in the EKF -
add_definitions(-DENFORCE_SO3_FREQ=50)
-- frequency (in number of vision measurements) at which to project rotation matrices to SO(3) to prevent accumulation of numerical error
Ubuntu:
$ git clone https://github.com/ucla-vision/xivo.git
$ cd xivo
$ ./build.sh
Arch Linux:
$ git clone https://github.com/ucla-vision/xivo.git
$ cd xivo
$ ./build_arch.sh
Mac OS:
$ git clone https://github.com/ucla-vision/xivo.git
$ cd xivo
$ ./build_mac.sh