public
Description: A collection of object-oriented Python wrappers for OpenCV
Clone URL: git://github.com/cv/opencv-wrappers.git
Search Repo:
cv (author)
Fri May 16 08:06:53 -0700 2008
commit  3f882bd3847227a4867a5f791ee12f96c23933a2
tree    4cefc0479131cd1758925d9a35f1e7ff62e0c961
parent  0e0b9b1c6310d21a6af1c956891419b7b1510622
README.textile

Wrappers for OpenCV

A collection of object-oriented wrappers in Python wrappers for OpenCV.

Motivation

OpenCV provides an enormous amount of useful utilities and functions related to computer vision, from matrix operations to face recognition. It comes with a set of bindings for Python generated by SWIG, but unfortunately these aren’t very Object Oriented, and can be tricky to use (users have to remember to release resources by hand, etc).

This is a still very incomplete set of objects that wrap common concepts in OpenCV into objects: Camera, Image, Window and so on. There are definitely tons of bugs, so beware. This project has been set up only as a way of representing the knowledge the authors have gathered about OpenCV and is not intended to be a complete set of OO wrappers for the library – but contributions of any kind are definitely welcome.

Installation

Make sure you have OpenCV and the Python bindings for it. If you have everything installed correctly, you should be able to run this successfully:

python -c 'import opencv; import opencv.highgui'

If this command generates any output, you need to have a look at your installation of OpenCV and the Python bindings. Make sure you’re using the correct version of Python, and that it is compatible with the bindings.

Example


# Outputs the video coming from the first webcam found into the main window.
# See also @camera-display.py@.

from wrappers import *

camera = Camera(CV_CAP_ANY)
window = Window()

while True:
  window.show(camera.frame())
  if escape_pressed():
    window.destroy()
    break