This is sort of a rough model of what the site is supposed to look like; more when K2 final is out.
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.
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:
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
I’ve been writing xeyes with face detection using opencv as a crash course in pygame. Pictures and code tomorrow.
There’s now a little icon on the bottom of this page proclaiming that everything on this site that I hold copyright on is licensed Creative Commons Attribution-Share Alike 3.0. That is, everything that does not state its own license; some source code may be licensed GPLv2 or GPLv3.
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.
Do companies actually think about what they put on their product packaging? Inquiring minds want to know. Google only gave me a few fellow confused bloggers, so I resorted to the source, the Reddi-wip hotline. Apparently Reddi-wip is a more difficult product than one would expect, as it took about 15 minutes to get through the calling queue. The customer service representative seemed amused by my question and disappeared for a few minutes to find the answer. The response, which sounded a whole lot like she made it up on the spot, was that the cryptic message is a reminder to customers that they can purchase Reddi-wip on days that are not national holidays. Crisis averted…
OpenCV has issues using the camera on the XO, rising from the way it negotiates color palette settings with the OV7670 v4l2 driver. I haven’t delved deep enough into v4l2 yet to come up with a proper fix for either the driver or OpenCV. However, I have a temporary fix that (probably) works fine but is very ugly.
The easy and dirty solution is to install the opencv, opencv-devel, and opencv-python packages with yum, to download the libhighgui.so.1.0.0 that I compiled, and to copy it to /usr/lib/libhighgui.so.1.0.0. In short:
sudo yum install opencv opencv-devel opencv-python
sudo wget http://eclecti.cc/files/2008/03/libhighguiso100 -O /usr/lib/libhighgui.so.1.0.0