Skip to content

Commit

Permalink
Merge branch 'main' into features/dense_matching
Browse files Browse the repository at this point in the history
  • Loading branch information
B1ueber2y authored Nov 28, 2024
2 parents 9141712 + 6b5a6f0 commit c8bb7d8
Show file tree
Hide file tree
Showing 105 changed files with 852 additions and 615 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: limap

on:
push:
branches:
- main
- release/*
pull_request:
types: [ assigned, opened, synchronize, reopened ]
release:
types: [ published, edited ]

jobs:
build:
name: ${{ matrix.config.os }} ${{ matrix.config.arch }}
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config: [
{os: ubuntu-latest},
]
env:
COMPILER_CACHE_VERSION: 1
COMPILER_CACHE_DIR: ${{ github.workspace }}/compiler-cache
CCACHE_DIR: ${{ github.workspace }}/compiler-cache/ccache
CCACHE_BASEDIR: ${{ github.workspace }}
# For faster builds in PRs, skip all but the latest Python versions.
PULL_REQUEST_CIBW_BUILD: cp39-{manylinux}*
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: cache-builds
with:
key: limap-v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ github.run_id }}-${{ github.run_number }}
restore-keys: limap-v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.arch }}
path: ${{ env.COMPILER_CACHE_DIR }}

- name: Set env (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update && sudo apt-get install -y \
git \
build-essential \
cmake \
ninja-build \
libboost-program-options-dev \
libboost-graph-dev \
libboost-system-dev \
libeigen3-dev \
libceres-dev \
libflann-dev \
libfreeimage-dev \
libmetis-dev \
libgoogle-glog-dev \
libgtest-dev \
libgmock-dev \
libsqlite3-dev \
libglew-dev \
qtbase5-dev \
libqt5opengl5-dev \
libcgal-dev \
libcgal-qt5-dev \
libgl1-mesa-dri \
libunwind-dev \
xvfb
- name: Install Python dependencies
run: |
git submodule update --init --recursive
python -m pip install --upgrade pip
python -m pip install setuptools
python -m pip install -r requirements.txt # If you have a requirements file
- name: Build
run: |
python -m pip install -v .
- name: Run Python tests
run: |
python -c "import limap; print(limap.__version__)"
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ jobs:
exit 0
fi
set +x -euo pipefail
sudo apt-get update && sudo apt-get install -y clang-format-14
python -m pip install ruff==0.6.7
python -m pip install ruff==0.6.7 clang-format==19.1.0
./scripts/format/clang_format.sh
./scripts/format/python.sh
git diff --name-only
Expand Down
19 changes: 3 additions & 16 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
[submodule "third-party/Hierarchical-Localization"]
path = third-party/Hierarchical-Localization
url = https://github.com/cvg/Hierarchical-Localization.git
[submodule "third-party/JLinkage"]
path = third-party/JLinkage
url = https://github.com/B1ueber2y/JLinkage
[submodule "third-party/libigl"]
path = third-party/libigl
url = https://github.com/B1ueber2y/libigl.git
[submodule "third-party/RansacLib"]
path = third-party/RansacLib
url = https://github.com/B1ueber2y/RansacLib.git
Expand All @@ -20,19 +14,12 @@
[submodule "third-party/pytlsd"]
path = third-party/pytlsd
url = https://github.com/iago-suarez/pytlsd.git
[submodule "third-party/pytlbd"]
path = third-party/pytlbd
url = https://github.com/iago-suarez/pytlbd.git
[submodule "third-party/hawp"]
path = third-party/hawp
url = https://github.com/cherubicXN/hawp.git
ignore = dirty
[submodule "third-party/TP-LSD"]
path = third-party/TP-LSD
url = https://github.com/rpautrat/TP-LSD.git
[submodule "third-party/DeepLSD"]
path = third-party/DeepLSD
url = https://github.com/cvg/DeepLSD.git
[submodule "third-party/GlueStick"]
path = third-party/GlueStick
url = https://github.com/cvg/GlueStick.git
[submodule "third-party/libigl"]
path = third-party/libigl
url = https://github.com/libigl/libigl.git
88 changes: 16 additions & 72 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ project(LIMAP)
# Include CMake dependencies
################################################################################
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.1)
message(FATAL_ERROR "GCC version needs to be at least 9.1")
endif()
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w -std=c++17 -std=gnu++17") # brute-force approach to make sure we are using C++17

# Include helper macros and commands, and allow the included file to override
# the CMake policies in this file
Expand All @@ -24,89 +23,34 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CMakeHelper.cmake NO_POLICY_SCOPE)
################################################################################
option(OPENMP_ENABLED "Whether to enable OpenMP parallelization" ON)
option(INTERPOLATION_ENABLED "Whether to enable interpolation-based pixel-perfect optimization" OFF)
option(FETCH_POSELIB "Whether to use PoseLib with FetchContent or with self-installed software" ON)
option(FETCH_COLMAP "Whether to use COLMAP with FetchContent or with self-installed software" ON)
option(CUDA_ENABLED "Whether to use CUDA (only for the third-party COLMAP)" OFF)
option(FETCH_JLINKAGE "Whether to use JLinkage with FetchContent or with self-installed software" ON)

################################################################################
# Compiler specific configuration
################################################################################

if(OPENMP_ENABLED)
find_package(OpenMP)
if(OPENMP_FOUND)
message(STATUS "Enabling OpenMP support")
add_definitions("-DOPENMP_ENABLED")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
endif()

if(INTERPOLATION_ENABLED)
message(STATUS "Enabling pixelwise optimization with ceres interpolation. This should be disabled for clang.")
add_definitions("-DINTERPOLATION_ENABLED")
else()
message(STATUS "Disabling pixelwise optimization with ceres interpolation.")
endif()

################################################################################
# Find packages
################################################################################
find_package(Eigen3 3.3 REQUIRED)
find_package(COLMAP REQUIRED)
if(${CERES_VERSION} VERSION_LESS "2.2.0")
# ceres 2.2.0 changes the interface of local parameterization
add_definitions("-DCERES_PARAMETERIZATION_ENABLED")
endif()
find_package(PoseLib REQUIRED)

################################################################################
# Add sources
################################################################################

set(LIMAP_INCLUDE_DIRS
${HDF5_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}
${FREEIMAGE_INCLUDE_DIRS}
${COLMAP_INCLUDE_DIRS}
)

set(LIMAP_LINK_DIRS
${COLMAP_LINK_DIRS}
)

set(LIMAP_EXTERNAL_LIBRARIES
${CERES_LIBRARIES}
${FREEIMAGE_LIBRARIES}
${COLMAP_LIBRARIES}
${HDF5_C_LIBRARIES}
${Boost_LIBRARIES}
PoseLib::PoseLib
)

if(OPENMP_FOUND)
list(APPEND LIMAP_EXTERNAL_LIBRARIES ${OpenMP_libomp_LIBRARY})
endif()

set(LIMAP_INTERNAL_LIBRARIES
HighFive
pybind11::module
JLinkage
igl::core
)
include(cmake/FindDependencies.cmake)
include(cmake/InitVariables.cmake)

# include directories
include_directories(
third-party
limap
${PROJECT_SOURCE_DIR}
${LIMAP_INCLUDE_DIRS}
)

link_directories(${LIMAP_LINK_DIRS})

# Add sources
add_subdirectory(third-party)
include_directories(${JLINKAGE_INCLUDE_DIRS})
include_directories(${POSELIB_INCLUDE_DIRS})
include_directories(${RANSACLIB_INCLUDE_DIRS})
add_subdirectory(limap)

# Install find_package scripts for dependencies.
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake
DESTINATION share/colmap
FILES_MATCHING PATTERN "Find*.cmake")

################################################################################
# Generate source groups for Visual Studio, XCode, etc.
################################################################################
Expand Down
33 changes: 27 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,38 @@ In this project, we provide interfaces for various geometric operations on 2D/3D

## Installation

**Note**: COLMAP has been under active development since summer 2023, so we currently only support COLMAP 3.8.

**Install the dependencies as follows:**
* CMake >= 3.17
* COLMAP 3.8 [[the official guide](https://colmap.github.io/install.html)] _make sure to use the tag 3.8_
* PoseLib [[Guide](misc/install/poselib.md)]
* All dependencies for third-party: COLMAP (will be installed with FetchContent). From [[official guide](https://colmap.github.io/install.html)]
```bash
sudo apt-get install \
git \
cmake \
ninja-build \
build-essential \
libboost-program-options-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-system-dev \
libeigen3-dev \
libflann-dev \
libfreeimage-dev \
libmetis-dev \
libgoogle-glog-dev \
libgtest-dev \
libgmock-dev \
libsqlite3-dev \
libglew-dev \
qtbase5-dev \
libqt5opengl5-dev \
libcgal-dev \
libceres-dev
```
* HDF5
```bash
sudo apt-get install libhdf5-dev
```
* Python 3.9 + required packages
* Python >= 3.9 + required packages
```bash
git submodule update --init --recursive

Expand Down Expand Up @@ -97,7 +118,7 @@ If you wish to use the methods with **separate installation needed** you need to
**The following line detectors are currently supported:**
- [LSD](https://github.com/iago-suarez/pytlsd)
- [SOLD2](https://github.com/cvg/SOLD2)
- [HAWPv3](https://github.com/cherubicXN/hawp)
- [HAWP](https://github.com/cherubicXN/hawp) (separate installation needed [[Guide](misc/install/hawpv3.md)])
- [TP-LSD](https://github.com/Siyuada7/TP-LSD) (separate installation needed [[Guide](misc/install/tp_lsd.md)])
- [DeepLSD](https://github.com/cvg/DeepLSD)

Expand Down
2 changes: 1 addition & 1 deletion cfgs/fitnmerge/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fitting:
var2d: -1.0 # depends on the detector
ransac_th: 0.75
min_percentage_inliers: 0.9
n_jobs: 4
n_jobs: 1

##############################
# merging config
Expand Down
82 changes: 82 additions & 0 deletions cmake/FindDependencies.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
################################################################################
# Find packages
################################################################################
find_package(Eigen3 3.4 REQUIRED)
find_package(FreeImage REQUIRED)
find_package(Glog REQUIRED)
if(DEFINED glog_VERSION_MAJOR)
# Older versions of glog don't export version variables.
add_definitions("-DGLOG_VERSION_MAJOR=${glog_VERSION_MAJOR}")
add_definitions("-DGLOG_VERSION_MINOR=${glog_VERSION_MINOR}")
endif()
find_package(Boost REQUIRED COMPONENTS
graph
program_options
system)

# Ceres
find_package(Ceres REQUIRED COMPONENTS SuiteSparse)
if(${CERES_VERSION} VERSION_LESS "2.2.0")
# ceres 2.2.0 changes the interface of local parameterization
add_definitions("-DCERES_PARAMETERIZATION_ENABLED")
endif()
if(INTERPOLATION_ENABLED)
message(STATUS "Enabling pixelwise optimization with ceres interpolation. This should be disabled for clang.")
add_definitions("-DINTERPOLATION_ENABLED")
else()
message(STATUS "Disabling pixelwise optimization with ceres interpolation.")
endif()

# OpenMP
if(OPENMP_ENABLED)
find_package(OpenMP)
if(OPENMP_FOUND)
message(STATUS "Enabling OpenMP support")
add_definitions("-DOPENMP_ENABLED")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
endif()

# PoseLib
include(FetchContent)
FetchContent_Declare(PoseLib
GIT_REPOSITORY https://github.com/PoseLib/PoseLib.git
GIT_TAG a84c545a9895e46d12a3f5ccde2581c25e6a6953
EXCLUDE_FROM_ALL
)
message(STATUS "Configuring PoseLib...")
if (FETCH_POSELIB)
FetchContent_MakeAvailable(PoseLib)
else()
find_package(PoseLib REQUIRED)
endif()
message(STATUS "Configuring PoseLib... done")

# COLMAP
FetchContent_Declare(COLMAP
GIT_REPOSITORY https://github.com/colmap/colmap.git
GIT_TAG 63b2cc000de32dc697f45ef1576dec7e67abddbc
EXCLUDE_FROM_ALL
)
message(STATUS "Configuring COLMAP...")
if (FETCH_COLMAP)
FetchContent_MakeAvailable(COLMAP)
else()
find_package(COLMAP REQUIRED)
endif()
message(STATUS "Configuring COLMAP... done")

# JLinkage
FetchContent_Declare(JLinkage
GIT_REPOSITORY https://github.com/B1ueber2y/JLinkage.git
GIT_TAG 452d67eda005db01a02071a5af8f0eced0a02079
EXCLUDE_FROM_ALL
)
message(STATUS "Configuring JLinkage...")
if (FETCH_JLINKAGE)
FetchContent_MakeAvailable(JLinkage)
else()
find_package(JLinkage REQUIRED)
endif()
message(STATUS "Configuring JLinkage... done")
Loading

0 comments on commit c8bb7d8

Please sign in to comment.