How to generate python bindings for OpenCV based projects

asked 2016-04-09 10:57:58 -0600

pixelou gravatar image

Hello there,

There are many C++ projects out there that use OpenCV. On the other hand, it is very tempting to use the python interface of OpenCV, especially for experimentations. Unfortunately, it is rather difficult to write the bindings for the 3rd party libraries manually.

To simplify this task, I have extracted the header parsing utilities from the OpenCV source tree to make it standalone (available here, but it is not production ready).

Use cases are:

  • Your project uses the python bindings of OpenCV, but you need to use an external library in C++. You can write an parser-frendly wrapper for this library and have the python binding automatically generated.
  • Your project is written in C++ and you want to distribute an python binding.
  • Your project is written in python but you need to use optimzed C++ code. This code will be compiled into a python module which you can load back into your project.
  • [WIP] You wish to compile one module from OpenCV source tree (to test an update from the source tree for example) and generate the python bindings without messing up your OpenCV installation.
  • [WIP, useful?] You write a module that you want to propose for integration in the extra-modules of OpenCV, you want to test the associated python bindings or examples

So my question is: Do you think such a project is useful? How would you prefer to make your bindings?

edit retag flag offensive close merge delete