The Summer of Nirav

I was heading towards a Summer of George, with full autonomy and empty schedules, but like all Summers of George, this one ended before it started.  Due probably to a lack of self esteem on my part, I abruptly ended up with two opportunities of a lifetime at the end of the semester.  I don’t need to wait until the end of summer to retrospectively observe that I made a rookie mistake here by not choosing between them.

This summer, I’m writing a computer vision library for pygame via One Laptop Per Child via Google Summer of Code.  The admittedly terse and vague project description is at Google Code.  This is the culmination of the comparatively primitive vision experiments I’ve been documenting on this website (or is it the culmination like the tip of an iceburg?).  Anyway, the plan is to start with adding v4l2 support to pygame, pulling frames from the camera buffer as surfarrays.  Next up is adding any vision functions to pygame.transform that could be useful for gaming purposes: connected components, thresholding, centroids, optical flow, convolution, etc (I’m taking requests, if there is something else you want).  Finally, I’ll make a simple example program that uses as many of the functions as possible.  Apparently a lot of people are interested in using webcams in pygame, so this should be a good project.  I’m also going to learn probably more than I ever wanted to about v4l2 drivers, python, and matrix operations.

This summer, I’m also doing tech consulting with the Ministry of Health in Palau via Tech Consulting in the Global Community, a program of TechBridgeWorld.  I don’t yet know the full details of what my colleague and I will be doing, but we will be helping several people in Palau use technology to solve their problems in a way that is sustainable in the long term (awkwardly bludgeoning buzzwords).  This consulting happens to take place in one of the most beautiful countries in the world.  This consulting also happens to take place in a country with less bandwidth than the average dorm room.

Until then, I’m decompressing as much as possible for the time wedged between school and life.

2 Comments on The Summer of Nirav

A Simple Hack for my Apartment’s Buzzer

The apartment building I live in uses a system where visitors can type in an apartment’s number on a keypad in the lobby, which calls the phone in the apartment.  Someone in the apartment would then pick up the phone, confirm that the visitor is not Charles Manson, John Wayne Gacy, or Boba Fett, and then dial the number 9.  The door of the building would then unlock, and the visitor could proceed up to the apartment, perhaps for a tea party.

The problem with this is that my roommate and I were too lazy to pick up the phone every time someone wanted in.  My roommate, a fellow engineer, had concocted a plan to build a circuit that would answer the phone call and then generate the DTMF tone for the number 9, the pair of 1477 hz and 852 hz frequencies.  The obvious flaw in this was that if we were too lazy to walk 5 feet to the phone, there was no way we were going to build and debug this circuit.  I had then planned to use my Asterisk box to pick up the call and generate the tone, but the prices on decent FXO cards were way out of my budget.

No, my friends, the solution was not a carefully crafted circuit or a complex piece of software but a lowly answering machine.  I used Matlab to create a WAV of 1477 hz and 852 hz sine waves.  We hit the “record answering machine message” button, cranked up the speakers, and blasted the number 9.  Now, when someone buzzes in, the phone silently rings for a moment, the answering machine plays the 9 tone, and like magic, the door unlocks.

It may not be the most elegant solution, but its simple, robust, cheap, and easy.  It’s been working for the last year and a half, and many of the other people living in the building are using it too.  Of course, it completely eliminates security, but if you wait in the lobby for a few minutes and don’t look like Jack the Ripper, some kind soul will let you in anyway.

8 Comments on A Simple Hack for my Apartment’s Buzzer

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

8 Comments on PyEyes: xeyes in Python with Face Tracking

Paint with Color Based Object Tracking on the OLPC XO

AC Adapter Art

 It took a lot of pain, but I got color based object tracking working for Wade Brainerd‘s Colors! Activity, which he ported from Colors! for Nintendo DS by Jens Andersson.  The tracking for what I have right now is calibrated to use the XO’s AC adapter.  It’s a bright, uniform, unique color, and it’s something that every XO owner has.  It’s pretty nifty watching the brush follow the camera around, but the real magic happens with you enable “Pressure Sensitivity” in the palette menu of Colors!  The brush will actually change size and opacity based on how far you hold the charger from the camera.  It works better than I could have ever expected, and this is just the start.  The next step I’m planning is to let the user pick any real life object they want and use it as a brush, with the color of the object being the color of the brush on screen.

Download my modified Colors! XO Activity

Read on for information on how it works and how to use it.

13 Comments on Paint with Color Based Object Tracking on the OLPC XO