Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,26 @@ build
# pip and python build
*.egg-info*
wheelhouse
dist
dist

# cmake
CMakeCache.txt
CMakeFiles/
Makefile
cmake_install.cmake
compile_commands.json
lib/pymagsac.abi3.so

# clang
.clangd

# NixOs
shell.nix

# gtags
GPATH
GRTAGS
GTAGS

# jupyter
.ipynb_checkpoints/
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "lib/pybind11"]
path = lib/pybind11
url = https://github.com/pybind/pybind11.git
[submodule "graph-cut-ransac"]
path = graph-cut-ransac
url = https://github.com/danini/graph-cut-ransac
[submodule "lib/nanobind"]
path = lib/nanobind
url = https://github.com/wjakob/nanobind.git
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
repos:
# Validate github workflow files
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.0
hooks:
- id: ruff-check
args: [--fix, --exit-non-zero-on-fix]
exclude: ^examples/
- id: ruff-format

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.36.1
hooks:
- id: check-github-workflows
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.25
hooks:
- id: validate-pyproject
7 changes: 3 additions & 4 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ Compiling

```shell
$ git clone https://github.com/danini/magsac
$ mkdir build
$ cd build
$ cmake-gui ..
$ cmake -S . -B build
$ cmake --build build
```

- CMake: Configure + Generate
- CMake: Set the OpenCV_DIR if needed.
- Build
- Build
34 changes: 23 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.15)

project(MAGSAC LANGUAGES CXX)

Expand All @@ -23,8 +23,7 @@ ENDIF(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "-fpermissive")
set(CMAKE_CXX_FLAGS "-fPIC")
set(CMAKE_CXX_FLAGS "-fpermissive -fPIC")
# ==============================================================================
# Find OpenCV
# ==============================================================================
Expand Down Expand Up @@ -66,6 +65,17 @@ if (USE_OPENMP)
set(TRGT_LNK_LBS_ADDITIONAL OpenMP::OpenMP_CXX)
endif (USE_OPENMP)

# ==============================================================================
# Nanobind
# ==============================================================================
add_subdirectory(${PROJECT_SOURCE_DIR}/lib/nanobind)

find_package(Python
REQUIRED COMPONENTS Interpreter Development.Module
OPTIONAL_COMPONENTS Development.SABIModule)

# find_package(nanobind CONFIG REQUIRED) # if using pyproject

# ==============================================================================
# Includes
# ==============================================================================
Expand Down Expand Up @@ -119,13 +129,16 @@ file(GLOB_RECURSE SRCS_MAGSAC
# Structure: Python binding
# ==============================================================================
# Generate python module
add_subdirectory(lib/pybind11)

pybind11_add_module(pymagsac
${SOURCE_DIR}/src/bindings.cpp
${SOURCE_DIR}/src/magsac_python.cpp
${HDRS_MAGSAC}
${SRCS_MAGSAC})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)

nanobind_add_module(pymagsac
STABLE_ABI
${SOURCE_DIR}/src/bindings.cpp
${SOURCE_DIR}/src/magsac_python.cpp
${HDRS_MAGSAC}
${SRCS_MAGSAC}
)

target_link_libraries(pymagsac PRIVATE
${OpenCV_LIBS}
Expand All @@ -144,9 +157,8 @@ target_link_libraries(${PROJECT_NAME}
gflags
)

install(TARGETS pymagsac DESTINATION .)
install(TARGETS pymagsac LIBRARY DESTINATION pymagsac)

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)

# ==============================================================================
# Structure: Applications
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ If you use the algorithm, please cite
```

# Install from PyPI with pip
There are pre-compiled wheels for Windows and Linux for Python 3.8 - 3.11 that you can install with:
There are pre-compiled wheels for Windows and Linux for Python 3.10 - 3.14 that you can install with:

```
pip install pymagsac
Expand All @@ -55,21 +55,20 @@ Thanks to [@akaszynski](https://github.com/akaszynski) for his contributions.
To build and install C++-only `MAGSAC`/`MAGSAC++`, clone or download this repository and then build the project by CMAKE.
```shell
$ git clone https://github.com/danini/magsac --recursive
$ cd build
$ cmake ..
$ make
$ cmake -S . -B build
$ cmake --build build
```

# Install Python package and compile C++

```bash
python3 ./setup.py install
```
pip install .
```

or

```bash
pip3 install -e .
pip install -e .
```

# Example project
Expand Down
332 changes: 194 additions & 138 deletions examples/example_essential_matrix.ipynb

Large diffs are not rendered by default.

Loading
Loading