Package: pygcransac
Important newsI am happy to announce that Graph-Cut RANSAC had been included in OpenCV.
You can check the documentation atlink.Graph-Cut RANSACThe 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 athttp://openaccess.thecvf.com/content_cvpr_2018/papers/Barath_Graph-Cut_RANSAC_CVPR_2018_paper.pdfThe journal paper with updated spatial coherence term and additional experiments is available athttps://ieeexplore.ieee.org/document/9399280The method is explained in theLatest developments in RANSAC presentationfrom CVPR tutorialRANSAC in 2020.Experiments on homography, fundamental matrix, essential matrix, and 6D pose estimation are shown in the correspondingpresentationfrom the tutorial RANSAC in 2020.Install from PyPI with pipThere are pre-compiled wheels for Windows and Linux for Python 3.8 - 3.11 that you can install with:pip install pygcransacThanks to@akaszynskifor his contributions.Installation C++To build and install C++ onlyGraphCutRANSAC, clone or download this repository and then build the project by CMAKE.$gitclonehttps://github.com/danini/graph-cut-ransac
$cdbuild
$cmake..
$makeInstall Python package and compile C++python3./setup.pyinstallorpip3install-e.Example projectTo build the sample project showing examples of fundamental matrix, homography and essential matrix fitting, set variableCREATE_SAMPLE_PROJECT = ONwhen creating the project in CMAKE.
Then$cdbuild
$./SampleProjectRequirementsEigen 3.0 or higherCMake 2.8.12 or higherOpenCV 3.0 or higherA modern compiler with C++17 supportExample of usage in pythonimportpygcransach1,w1=img1.shapeh2,w2=img2.shapeH,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 exampleThe 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.RequirementsPython 3CMake 2.8.12 or higherOpenCV 3.4A modern compiler with C++11 supportAcknowledgementsWhen 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 greatBenjamin Jackpython_cpp_example.