Skip to main content

Graph-Cut RANSAC

Project description

Important news

  • I am happy to announce that Graph-Cut RANSAC had been included in OpenCV. You can check the documentation at link.

Graph-Cut RANSAC

The Graph-Cut RANSAC algorithm proposed in paper: Daniel Barath and Jiri Matas; Graph-Cut RANSAC, Conference on Computer Vision and Pattern Recognition, 2018. It is available at http://openaccess.thecvf.com/content_cvpr_2018/papers/Barath_Graph-Cut_RANSAC_CVPR_2018_paper.pdf

The journal paper with updated spatial coherence term and additional experiments is available at https://ieeexplore.ieee.org/document/9399280

The method is explained in the Latest developments in RANSAC presentation from CVPR tutorial RANSAC in 2020.

Experiments on homography, fundamental matrix, essential matrix, and 6D pose estimation are shown in the corresponding presentation from the tutorial RANSAC in 2020.

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:

pip install pygcransac

Thanks to @akaszynski for his contributions.

Installation C++

To build and install C++ only GraphCutRANSAC, clone or download this repository and then build the project by CMAKE.

$ git clone https://github.com/danini/graph-cut-ransac
$ cd build
$ cmake ..
$ make

Install Python package and compile C++

python3 ./setup.py install

or

pip3 install -e .

Example project

To build the sample project showing examples of fundamental matrix, homography and essential matrix fitting, set variable CREATE_SAMPLE_PROJECT = ON when creating the project in CMAKE. Then

$ cd build
$ ./SampleProject

Requirements

  • Eigen 3.0 or higher
  • CMake 2.8.12 or higher
  • OpenCV 3.0 or higher
  • A modern compiler with C++17 support

Example of usage in python

import pygcransac
h1, w1 = img1.shape
h2, w2 = img2.shape
H, mask = pygcransac.findHomography(src_pts, dst_pts, h1, w1, h2, w2, 3.0)
F, mask = pygcransac.findFundamentalMatrix(src_pts, dst_pts, h1, w1, h2, w2, 3.0)

Jupyter Notebook example

The example for homography fitting is available at: notebook.

The example for fundamental matrix fitting is available at: notebook.

The example for essential matrix fitting is available at: notebook.

The example for essential matrix fitting with planar motion assumption is available at: notebook.

The example for essential matrix fitting with known gravity is available at: notebook.

The example for essential matrix fitting is available at: notebook.

The example for 6D pose fitting is available at: notebook.

An example comparing different samplers on fundamental matrix fitting: notebook.

Jupyter Notebook example (Affine and SIFT correspondence-based solvers)

The example for homography fitting to SIFT correspondences is available at: notebook.

The example for essential matrix fitting to SIFT correspondences is available at: notebook.

The example for fundamental matrix fitting to SIFT correspondences is available at: notebook.

The example for homography fitting to affine correspondences is available at: notebook.

The example for essential matrix fitting to affine correspondences is available at: notebook.

The example for fundamental matrix fitting to affine correspondences is available at: notebook.

Requirements

  • Python 3
  • CMake 2.8.12 or higher
  • OpenCV 3.4
  • A modern compiler with C++11 support

Acknowledgements

When using the algorithm, please cite

@inproceedings{GCRansac2018,
	author = {Barath, Daniel and Matas, Jiri},
	title = {Graph-cut {RANSAC}},
	booktitle = {Conference on Computer Vision and Pattern Recognition},
	year = {2018},
}

If you use it together with Progressive NAPSAC sampling or DEGENSAC, please cite

@inproceedings{PNAPSAC2020,
	author = {Barath, Daniel and Noskova, Jana and Ivashechkin, Maksym and Matas, Jiri},
	title = {{MAGSAC}++, a Fast, Reliable and Accurate Robust Estimator},
	booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
	month = {June},
	year = {2020}
}

@inproceedings{Degensac2005,
	author = {Chum, Ondrej and Werner, Tomas and Matas, Jiri},
	title = {Two-View Geometry Estimation Unaffected by a Dominant Plane},
	booktitle = {Conference on Computer Vision and Pattern Recognition},
	year = {2005},
}

If you use with Space Partitioning turned on, please cite

@inproceedings{spaceransac2022,
	author = {Barath, Daniel and Valasek, Gabor},
	title = {Space-Partitioning {RANSAC}},
	journal={European Conference on Computer Vision},
	year = {2022}
}

The Python wrapper part is based on the great Benjamin Jack python_cpp_example.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygcransac-0.1.1.tar.gz (16.0 MB view details)

Uploaded Source

Built Distributions

pygcransac-0.1.1-cp312-cp312-win_amd64.whl (5.0 MB view details)

Uploaded CPython 3.12 Windows x86-64

pygcransac-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pygcransac-0.1.1-cp311-cp311-win_amd64.whl (5.0 MB view details)

Uploaded CPython 3.11 Windows x86-64

pygcransac-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pygcransac-0.1.1-cp310-cp310-win_amd64.whl (5.0 MB view details)

Uploaded CPython 3.10 Windows x86-64

pygcransac-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pygcransac-0.1.1-cp39-cp39-win_amd64.whl (5.0 MB view details)

Uploaded CPython 3.9 Windows x86-64

pygcransac-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pygcransac-0.1.1-cp38-cp38-win_amd64.whl (5.0 MB view details)

Uploaded CPython 3.8 Windows x86-64

pygcransac-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

File details

Details for the file pygcransac-0.1.1.tar.gz.

File metadata

  • Download URL: pygcransac-0.1.1.tar.gz
  • Upload date:
  • Size: 16.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for pygcransac-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ef5d8b4e4fcb1967439af7e631bc2db5d9dcbb9e86660ac40bc9aa7d200ce6ee
MD5 2f719718083caa7542d59c718ccda1dc
BLAKE2b-256 76248571419b8643da5b21a69c905eab321633cd459ad69e6a325315fddb2003

See more details on using hashes here.

File details

Details for the file pygcransac-0.1.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pygcransac-0.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a96aee449e27ecc1066522d795ecb12ddec31da99ab129cac6cd11522ca6e31d
MD5 9c199933c64cf735819252c989f88b45
BLAKE2b-256 34aa4b4935f3a108abdeae4b30b9af189a52340b0d44bbc98930ed4bb73c83fb

See more details on using hashes here.

File details

Details for the file pygcransac-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygcransac-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 af4d1fbdcb143d8791eff785c9dfb525c65df90324babdf0b23ba47286926198
MD5 dcd12a90a130602907c1c29816e4b2a2
BLAKE2b-256 8c40cdaa589b7d817440afd0952637d4ddb222d8f20a778dd72761b70ab63354

See more details on using hashes here.

File details

Details for the file pygcransac-0.1.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pygcransac-0.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 21c9a180c0eaa0cdc3312c2fc8e6cf8b7713277b68b8f5eff6fbacfd41dedc70
MD5 68b1a98dcfa3017e1f19e228a00f3cb0
BLAKE2b-256 49bc3f442b6c92f0ba0e4b04298f7cb49d23b3550a2bdc596d6b3f271e28beef

See more details on using hashes here.

File details

Details for the file pygcransac-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygcransac-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e29174bb82c8c6e0c722423a3a97342eddd4a08f7d434d13b4df5d6ca68e7cba
MD5 e05ddf748352ab9ccddb8e7309e752e4
BLAKE2b-256 0ce8cf24b6441e59438f4109cc7fbed114035e4e7601139b000ab33ba6285bf2

See more details on using hashes here.

File details

Details for the file pygcransac-0.1.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pygcransac-0.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 76278c8d0fb0c5037fe430fe3d870f2496ada8b15c11a18a50f241cc8c78df3e
MD5 4f19de122f26798cffee4d457ed2af57
BLAKE2b-256 f283b409cc185368d8fb9ece9d985eb214f36d8be1e3062a18e8a488d60ca3a4

See more details on using hashes here.

File details

Details for the file pygcransac-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygcransac-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 08619fa8c5d1cd90576017e5f7e731703bc8ca53f0a228dd1512a78823e07055
MD5 c4909e70600061049c26d58682d5dbdf
BLAKE2b-256 18255bdaf7b75b631a62a208ac215cf7edf7af78e95e656610b71f95ba8b62d0

See more details on using hashes here.

File details

Details for the file pygcransac-0.1.1-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pygcransac-0.1.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ccbe51394882bae0af0b043689a0255c0401e04ff26f314e380634d73f8334e5
MD5 fad89369fad0867257fb5df63960b433
BLAKE2b-256 76e7c2d692cf1fd779314ebb6827f129da7e3162cecf5aa0122ca247eb58b0bb

See more details on using hashes here.

File details

Details for the file pygcransac-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygcransac-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 59b44411ce2c13896b6b5420926fb55f67a3789329bf71c507e341294ed86ba1
MD5 036794e82589466c3b73a98e18b2a54e
BLAKE2b-256 dc9c628b8e27a8953eac0b63e7538b663ce274f3aaf876b22091b7d2a612b4aa

See more details on using hashes here.

File details

Details for the file pygcransac-0.1.1-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pygcransac-0.1.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 e6a4112ed059e538fd4389f55496f4680940cf64be55f29abf9a5b91a342c130
MD5 63a4d630f46324691952fa72d586ea1a
BLAKE2b-256 ef204a390d068fcf94e1d461fa418a172a97e6b35ddf6b721a8ae9631504e8de

See more details on using hashes here.

File details

Details for the file pygcransac-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygcransac-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ecbc84cbeac071eceb0b7f11bdbc8df78d416b965ccc00adef024b519cf19bbb
MD5 6e5fb7b386d716d16e8e5823aea57bf4
BLAKE2b-256 0078cc2890ada2df4a35f7c1fe610d6e7771fd8f51fcb44ee929cdb21e0f1a20

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page