Git Product home page Git Product logo

pymagsac's Introduction

This repo is deprecated! The Python wrapper is now merged to the main repo that you can find at Link.

MAGSAC++'s Python Wrapper

This repository contains an Python wrapper of MAGSAC and MAGSAC++.

The main repository is at https://github.com/danini/magsac

If you use the algorithm, please cite

@inproceedings{barath2019magsac,
	author = {Barath, Daniel and Matas, Jiri and Noskova, Jana},
	title = {{MAGSAC}: marginalizing sample consensus},
	booktitle = {Conference on Computer Vision and Pattern Recognition},
	year = {2019},
}

@inproceedings{barath2019magsacplusplus,
	author = {Barath, Daniel and Noskova, Jana and Ivashechkin, Maksym and Matas, Jiri},
	title = {{MAGSAC}++, a fast, reliable and accurate robust estimator},
	booktitle = {arXiv preprint:1912.05909},
	year = {2019},
}

If you use it for fundamental matrix estimation with DEGENSAC turned on, please cite

@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},
}

Performance of MAGSAC++

MAGSAC++ is the state of the art according to "RANSAC in 2020" CVPR tutorial's experiments.

Performance of MAGSAC

MAGSAC 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

Installation

To build and install python_cpp_example, clone or download this repository and then, from within the repository, run:

python3 ./setup.py install

or

pip3 install .

Example of usage

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

See also this notebook

Requirements

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

Acknowledgements

This wrapper part is based on great Benjamin Jack python_cpp_example.

pymagsac's People

Contributors

danini avatar ducha-aiki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pymagsac's Issues

/usr/bin/ld: cannot find -lEigen3::Eigen

Eigen is already installed.
Environment variable was set as: EIGEN3_INCLUDE_DIR=/usr/include/eigen3/Eigen
What happen ?= =

running install
running bdist_egg
running egg_info
writing src/pymagsac.egg-info/PKG-INFO
writing dependency_links to src/pymagsac.egg-info/dependency_links.txt
writing top-level names to src/pymagsac.egg-info/top_level.txt
reading manifest file 'src/pymagsac.egg-info/SOURCES.txt'
writing manifest file 'src/pymagsac.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
-- pybind11 v2.1.1
-- Configuring done
CMake Warning (dev) at lib/pybind11/tools/pybind11Tools.cmake:127 (add_library):
Policy CMP0028 is not set: Double colon in target name means ALIAS or
IMPORTED target. Run "cmake --help-policy CMP0028" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.

Target "pymagsac" links to target "Eigen3::Eigen" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
Call Stack (most recent call first):
CMakeLists.txt:55 (pybind11_add_module)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /data/for_jr/pymagsac/build/temp.linux-x86_64-3.5
[ 33%] Linking CXX shared module ../lib.linux-x86_64-3.5/pymagsac/pymagsac.cpython-35m-x86_64-linux-gnu.so
/usr/bin/ld: cannot find -lEigen3::Eigen
collect2: error: ld returned 1 exit status
CMakeFiles/pymagsac.dir/build.make:137: recipe for target '../lib.linux-x86_64-3.5/pymagsac/pymagsac.cpython-35m-x86_64-linux-gnu.so' failed
make[2]: *** [../lib.linux-x86_64-3.5/pymagsac/pymagsac.cpython-35m-x86_64-linux-gnu.so] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/pymagsac.dir/all' failed
make[1]: *** [CMakeFiles/pymagsac.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Traceback (most recent call last):
File "setup.py", line 106, in
zip_safe=False,
File "/usr/local/lib/python3.5/dist-packages/setuptools/init.py", line 143, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.5/dist-packages/setuptools/command/install.py", line 67, in run
self.do_egg_install()
File "/usr/local/lib/python3.5/dist-packages/setuptools/command/install.py", line 109, in do_egg_install
self.run_command('bdist_egg')
File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.5/dist-packages/setuptools/command/bdist_egg.py", line 172, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "/usr/local/lib/python3.5/dist-packages/setuptools/command/bdist_egg.py", line 158, in call_command
self.run_command(cmdname)
File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.5/dist-packages/setuptools/command/install_lib.py", line 11, in run
self.build()
File "/usr/lib/python3.5/distutils/command/install_lib.py", line 109, in build
self.run_command('build_ext')
File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "setup.py", line 38, in run
self.build_extension(ext)
File "setup.py", line 69, in build_extension
cwd=self.build_temp)
File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j2']' returned non-zero exit status 2

Doubt about the minimal case for findHomography

Hi,

Thank you for the bindings, they're very useful.

Is there any reason why in your implementation the minimum number of samples required for homography estimation is 7, as written here, and not 4?

I tried changing the line to 4 and rebuilt it, but the method started to return None, so I assume there are more changes required.

The results are not stable.

Hi @ducha-aiki
Thanks for your great work and sharing.
I tried your code on d2-net matching test.
I noticed the Homography results are different even I ran the same data in the same parameters(I mean the same threshold)
which the fluctuations can not be ignored.
Could you give me some suggestions to get a stable result?

install error

python3 ./setup.py install

After executing the above command, the following error appears

### gmake[2]: *** [CMakeFiles/pymagsac.dir/src/pymagsac/src/magsac_python.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/pymagsac.dir/all] Error 2

/home/admin/pymagsac/src/pymagsac/graph-cut-ransac/include/sampler.h:70:29: warning: inline function ‘bool gcransac::sampler::Sampler<_DataContainer, _IndexType>::sample(const std::vector&, _IndexType*, size_t) [with _DataContainer = cv::Mat; _IndexType = long unsigned int; size_t = long unsigned int]’ used but never defined [enabled by default]
OLGA_INLINE virtual bool sample(const std::vector<IndexType> &pool,
^
gmake[2]: *** [CMakeFiles/pymagsac.dir/src/pymagsac/src/magsac_python.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/pymagsac.dir/all] Error 2
gmake: *** [all] Error 2
Traceback (most recent call last):
File "./setup.py", line 106, in
zip_safe=False,
File "/usr/local/lib/python3.6/site-packages/setuptools/init.py", line 165, in setup
return distutils.core.setup(**attrs)
File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.6/site-packages/setuptools/command/install.py", line 67, in run
self.do_egg_install()
File "/usr/local/lib/python3.6/site-packages/setuptools/command/install.py", line 109, in do_egg_install
self.run_command('bdist_egg')
File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.6/site-packages/setuptools/command/bdist_egg.py", line 174, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "/usr/local/lib/python3.6/site-packages/setuptools/command/bdist_egg.py", line 160, in call_command
self.run_command(cmdname)
File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.6/site-packages/setuptools/command/install_lib.py", line 11, in run
self.build()
File "/usr/lib64/python3.6/distutils/command/install_lib.py", line 107, in build
self.run_command('build_ext')
File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "./setup.py", line 38, in run
self.build_extension(ext)
File "./setup.py", line 69, in build_extension
cwd=self.build_temp)
File "/usr/lib64/python3.6/subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j2']' returned non-zero exit status 2.

very slow even when only 40 points

I find pymagsac will be stuck sometimes, it can run tens of minutes and do not stop even when just 40 points. Here is an example.

import numpy as np
import pymagsac

data = np.load('test_data.npz')
for idx in range(100):
    print(idx)
    F, mask = pymagsac.findFundamentalMatrix(data['p1'], data['p2'], 3.0)

test_data.tar.gz

@danini @ducha-aiki

MAGSAC++ and Essential Matrix

This is an amazing repo. Great work!
I wish to know if this is also includes the author's latest MAGSAC++ or if it is just MAGSAC.
Also, is there a way to use this to find the essential matrix?
Thanks

License Issue

Hi @ducha-aiki - I just thought I'd let you know that the author of the MAGSAC algorithm licensed his repository under the GPL this morning (https://github.com/danini/magsac/blob/master/LICENSE), so you'll need to update this repository to reflect the GPL as well - this codebase can't be licensed under MIT and anyone who uses this would mistakenly violate his license!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.