PyEyes: xeyes in Python with Face Tracking


As a crash course in learning the basics of Pygame, I wrote a quick little Activity for the OLPC XO.  It is a clone of xeyes, except instead of following the mouse cursor, it uses the webcam to be creepy and follow your face.  It’s a bit slow, and kind of messy, but I did only make it for learning purposes.

It uses OpenCV, so you’re going to need a version of it that works on the XO.  The latest source from CVS works, or you can install a patched rpm of it that I hacked together:

sudo rpm -i

You’ll also need the opencv-python package, which is available in the repository.

sudo yum install opencv-python

You can get the .xo itself here: PyEyes-1.xo

Related Posts

8 Replies to “PyEyes: xeyes in Python with Face Tracking”

  1. would you mind uploading the source in a tarball? myself and some friends (listed at my webpage) wanted to run this on x86 which should not be a problem except that I dont’ understand the .xo pacakge format to get the python code

    thanks in advance

  2. A .xo is basically a .zip. You can open it with unzip on linux or any zip program on Windows (though you may need to rename it to .zip on Windows, I don’t know).

    The directory structure of the .xo is a bit weird, but the only part you need to run it on something that isn’t an OLPC is

    The dependencies are pygame and opencv-python. It’s really a very simple script. You’re going to need to adjust some of the parameters to make it look right depending on where you put the webcam. You could also use some trig for pupil placement, which I was too lazy to do.

  3. Ah thanks… ran got this
    Traceback (most recent call last):
    File “./”, line 56, in ?
    File “./”, line 11, in main
    capture = cvCreateCameraCapture(0)
    NameError: global name ‘cvCreateCameraCapture’ is not defined

    well i have python2.4 and python-opencv installed on debian etch … i don’t have a camera to make sure that is noth the problem … I’ll have a chance to test it next week i think

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.