• Stars
    star
    226
  • Rank 171,077 (Top 4 %)
  • Language
    C++
  • License
    MIT License
  • Created about 4 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Advanced RANSAC (DEGENSAC) with bells and whistles for H and F estimation

pydegensac

This repository contains an Python wrapper of RANSAC for homography and fundamental matrix estimation from sparse correspondences. It implements LO-RANSAC and DEGENSAC.

It was originally located in https://github.com/ducha-aiki/pyransac, but was renamed to avoid conflict with already existing pyransac in pypi from other author.

Performance

Vanilla pydegensac implementation is marginally better than OpenCV one and with degeneracy-check enabled (DEGENSAC) it is the state of the art, according to the recent study Yin et.al."Image Matching across Wide Baselines: From Paper to Practice", 2020.

IMW-benchmark

IMW-Challenge

For homography, pydegensac is worse than newest OpenCV MAGSAC++ (cv2.USAC_MAGSAC), but better than OpenCV vanilla RANSAC, according to recent Barath et al. A Large Scale Homography Benchmark, CVPR2023

H-benchmark

Installation

To build and install pydegensac, you can use pip from Windows, macOS and Linux:

pip install pydegensac

Or clone or download this repository and then, from within the repository, run:

python3 ./setup.py install

or

pip3 install .

To check if everything works, run the following:

cd examples
python -utt simple-example.py

You should see the following output:

Running homography estimation
cv2 found 40 inliers
OpenCV runtime 0.02355  sec
pydegensac found 78 inliers
pydegensac runtime 0.00320  sec
H =  [[ 5.59934334e-03 -2.36037104e-03 -2.78369679e+01]
 [ 4.86321171e-02 -1.24542142e-01 -1.00600649e+01]
 [ 1.95536148e-04  9.43300063e-06 -1.76685691e-01]]
Running fundamental matrix estimation
cv2 found 32 inliers
OpenCV runtime 0.67554  sec
pydegensac found 44 inliers
pydegensac 0.04702  sec
F =  [[-7.35044984e-04 -2.72572333e-03  1.38155992e+00]
 [ 1.43946998e-03  2.33120834e-05 -7.88961637e-01]
 [-3.35556093e-01  1.00000000e+00 -1.78675406e+02]]

Building hints from Tomasz Malisiewicz

  1. Compiling pydegensac without a system-wide install.
python3 ./setup.py build
  1. Compiling on Mac OS X computer Use GCC instead of Clang. The most recent version on my machine (installed via brew) is gcc-8. Try this:
CC=gcc-8 python3 ./setup.py build
  1. Compiling on Ubuntu 18.04 You need LAPACK and a few other libraries and I always forget those specific package names. Take a look at my pydegensac Dockerfile to see the exact packages you need to apt install on an Ubuntu 18.04 system (https://github.com/quantombone/pydegensac-dockerfile/blob/master/Dockerfile)
FROM ubuntu:18.04

update system

RUN apt-get clean
RUN apt-get update
RUN apt-get install -qy \
    git python3 python3-setuptools python3-dev
RUN apt-get install -y cmake libblas-dev liblapack-dev gfortran
RUN apt-get install -y g++ gcc

download and build pydegensac

RUN git clone https://github.com/ducha-aiki/pydegensac.git
WORKDIR pydegensac
RUN python3 ./setup.py build

copy built assets into target directory (which will be a -v volume)

CMD cp -R /pydegensac/build/lib.linux-x86_64-3.6/pydegensac /target_directory

dockerfile

https://github.com/quantombone/pydegensac-dockerfile

Example of usage

import pydegensac
H, mask = pydegensac.findHomography(src_pts, dst_pts, 3.0)
F, mask = pydegensac.findFundamentalMatrix(src_pts, dst_pts, 3.0)

See also this notebook with simple example

And this notebook with detailed explanation of possible options

Requirements

  • Python 3
  • CMake 2.8.12 or higher
  • LAPACK,
  • BLAS (OpenBLAS, MKL, Atlas, ...)
  • A modern compiler with C++11 support

Citation

Please cite us if you use this code:

@InProceedings{Chum2003,
author="Chum, Ond{\v{r}}ej and Matas, Ji{\v{r}}{\'i} and Kittler, Josef",
title="Locally Optimized RANSAC",
booktitle="Pattern Recognition",
year="2003",
}

@inproceedings{Chum2005,
author = {Chum, Ondrej and Werner, Tomas and Matas, Jiri},
title = {Two-View Geometry Estimation Unaffected by a Dominant Plane},
booktitle = {CVPR},
year = {2005},
}

@article{Mishkin2015MODS,
      title = "MODS: Fast and robust method for two-view matching ",
      journal = "Computer Vision and Image Understanding ",
      year = "2015",
      issn = "1077-3142",
      doi = "http://dx.doi.org/10.1016/j.cviu.2015.08.005",
      url = "http://www.sciencedirect.com/science/article/pii/S1077314215001800",
      author = "Dmytro Mishkin and Jiri Matas and Michal Perdoch"
}

Acknowledgements

This wrapper part is based on great Benjamin Jack python_cpp_example.

More Repositories

1

caffenet-benchmark

Evaluation of the CNN design choices performance on ImageNet-2012.
Jupyter Notebook
735
star
2

affnet

Code and weights for local feature affine shape estimation paper "Repeatability Is Not Enough: Learning Discriminative Affine Regions via Discriminability"
Python
238
star
3

pytorch-sift

PyTorch implementation of SIFT descriptor
Jupyter Notebook
158
star
4

manifold-diffusion

Diffusion on manifolds for image retrieval
Python
122
star
5

LSUVinit

Reference caffe implementation of LSUV initialization
C++
112
star
6

pyransac

Fast and accurate python RANSAC with LO, LAF-check
C++
90
star
7

mods

MODS (Matching On Demand with view Synthesis) is algorithm for wide-baseline matching.
C
85
star
8

ransac-tutorial-2020-data

Starter kit for the CVPR 2020 RANSAC tutorial benchmark
Jupyter Notebook
72
star
9

pymagsac

MAGSAC: marginalizing sample consensus, python version
C++
71
star
10

LSUV-keras

Simple implementation of the LSUV initialization in keras
Python
66
star
11

navigation-benchmark

Code for "Benchmarking Classic and Learned Navigation in Complex 3D Environments" paper
Python
63
star
12

google-retrieval-challenge-2019-fastai-starter

fast.ai starter kit for Google Landmark Retrieval 2019 challenge
Jupyter Notebook
63
star
13

LSUV-pytorch

Simple implementation of the LSUV initialization in PyTorch
Python
53
star
14

mods-light-zmq

MODS with external deep descriptors/detectors
C++
51
star
15

whale-identification-2018

Solution to Whale Identification Challenge 2018
Jupyter Notebook
51
star
16

extract_patches

Function for local patch extraction from OpenCV keypoints with proper bluring
Jupyter Notebook
42
star
17

numpy-sift

Numpy implementation of SIFT descriptor
Jupyter Notebook
38
star
18

matching-strategies-comparison

Comparison of the matching strategies for local feature descriptor
Jupyter Notebook
31
star
19

kornia_moons

Conversions between kornia and other computer vision libraries formats
Jupyter Notebook
28
star
20

hesaff-pytorch

PyTorch implementation of Hessian-Affine local feature detector
Python
22
star
21

hardnet-in-fastai2-and-kornia

Re-implementation of local descriptor HardNet training in fasta2+kornia
Jupyter Notebook
21
star
22

fast_atan2

Realization of the atan2 approximations faster than standard function.
C++
20
star
23

imc2021-sample-kornia-submission

Tutorial on how to create submission to Image Matching Challenge 2021
Jupyter Notebook
19
star
24

wide-baseline-stereo-blog

Blog about wide baseline stereo and local features
Jupyter Notebook
16
star
25

cpp-extract-patches

C++ header-only lib for extracting local patches
Jupyter Notebook
15
star
26

extract-patches-old

Simple function for local patch extraction from OpenCV keypoints.
Jupyter Notebook
14
star
27

pixelstitch

Simple tool for labelling the correspondences
Jupyter Notebook
14
star
28

imc2023-kornia-starter-pack

Simple jupyter notebook for 3D reconstruction using kornia and pycolmap
Jupyter Notebook
12
star
29

brown_phototour_revisited

New testing protocol for learning local patch descriptors on Brown Phototour dataset
Jupyter Notebook
12
star
30

vs3-cnn-labs

Computer vision labs for Vision and Sports Summer School 2022
Jupyter Notebook
10
star
31

mpv-templates-backup

Jupyter Notebook
9
star
32

wxbs-descriptors-benchmark

W1BS local patch descriptors benchmark
Python
9
star
33

keras-sift

Jupyter Notebook
7
star
34

local_feature_tutorial

Some examples of how one can use local features
Jupyter Notebook
6
star
35

imagewoofv2-fastv2-maxpoolblur

Jupyter Notebook
5
star
36

caffe-preprocessing-scripts

Creates caffe lmdb from bunch of dirs with images. Clean-up, check, resize included
Shell
5
star
37

wxbs-benchmark

Code for benchmarking image matchers on WxBS dataset/
Jupyter Notebook
3
star
38

creating-data-for-imc

Scripts for creating benchmark data for IMC 2021 competition
Python
3
star
39

ucn-pytorch

Jupyter Notebook
3
star
40

wisv2019-competition

Helper scripts for participation in http://cvg.dsi.unifi.it/cvg/index.php?id=caip-2019-contest
Jupyter Notebook
3
star
41

zeromqransac

C
2
star
42

COVID19-confirmed-cases-plot

Simple jupyter notebook to plot from John Hopkins data
Jupyter Notebook
2
star
43

nbu-reports-convert

Combine nbu reports to singlcsv
Roff
1
star
44

brown-revisited

Brown patch matching benchmark revisited
Jupyter Notebook
1
star
45

lsuv

Python package for neural network initialization
Python
1
star
46

sam1

Howework
Python
1
star