This package takes a completely new and different approach in wrapping OpenCV than traditional swig-based and ctypes-based approaches. It is intended to be a successor of ctypes-opencv and to provide Python bindings for OpenCV 2.0. ctypes-based approaches like ctypes-opencv, while being very flexible at wrapping functions and structures, are weak at wrapping OpenCV's C++ interface. On the other hand, swig-based approaches flatten C++ classes and create countless memory management issues. In PyOpenCV, we use Boost.Python, a C++ library which enables seamless interoperability between C++ and Python. PyOpenCV will offer a better solution than both ctypes-based and swig-based wrappers:
- Provide bindings for both the new C++ interface and the existing C interface of OpenCV 2.0,
- Preserve C++ data structures and avoid memory management issues,
- Run at a speed nearer to OpenCV's native speed than existing wrappers.
In addition, we use NumPy to provide fast indexing and slicing functionality to OpenCV's arrays like Scalar, Mat, and MatND, and to offer the user an option to work with their multi-dimensional arrays in NumPy. It is well-known that NumPy is one of the best packages (if not the best) for dealing with multi-dimensional arrays in Python. OpenCV 2.0 provides a new C++ meta-programming approach for matrix manipulation (i.e. MatExpr). It is a good attempt in C++. However, in Python, a package like NumPy is without a doubt a better solution. By incorporating NumPy into PyOpenCV to replace OpenCV 2.0's MatExpr approach, we seek to bring OpenCV and NumPy closer together, and offer a package that inherits the best of both world: fast computer vision functionality (OpenCV) and fast multi-dimensional array computation (NumPy).
At the moment, the development of PyOpenCV is at the alpha stage. I am the sole author/developer of the project. I am using Py++ to generate the source code, but I can only work in my spare time. Hence, the development speed is rather low. I constantly look for partners to develop the project. If you would like to join in, please let me know. Hopefully, the first release of PyOpenCV will be out in spring 2010.
Current Wrapping Status
CxCore
- C Interface: almost done
- C++ Interface : almost done
Cv
- C Interface : almost done
- C++ Interface : almost done
HighGui
- C Interface : done
- C++ Interface : done
CxFLANN
- C++ Interface : done
ML
- C Interface : almost done
- C++ Interface : almost done
CvAux
- C Interface : started
- C++ Interface : in progress
Bugs and Commentary
Please send information on issues of usage to Minh-Tri Pham <pmtri80@gmail.com>, post a message to ctypes-opencv's discussion group, or create an issue in the Issues pannel.