aku-aku: v.. To move a tall, flat bottomed object (such as a bookshelf) by swiveling it alternatively on its corners in a "walking" fashion. [After the book by Thor Heyerdahl theorising the statues of Easter Island were moved in this fashion.] source: LangMaker.com. Aku Aku also has another meaning to the islanders: a spiritual guide.
« 12 of 52: Dali MicroColours | Main Page | 14 of 52: Bhutto Lives! »
13 of 52: Infrared Detector
Posted by dav at 2007 December 24 12:05 AM
File under: Geek

This week's creative project is a hack I've been meaning to work on for quite some time: 2d coordinate input via a handheld device and a pc 'web' camera. I plan on going a bit further with this one at some point so this is really just a first round project. Here's a short video that shows how it works:

All charged-coupled devices, or in other words all digital cameras, pick up infrared light as well as visible light. You can verify this simply by pointing any tv remote at your digital camera (try the one on your phone) and hitting a button on the remote. By covering the built-in iSight camera that comes on my Apple computers with a filter that only passes infrared light you can use an infrared emitter to indicate positioning. Infrared-only filters can be quite expensive, but you can make one very cheaply by using a combination of "Congo Blue" and "Primary Red" filters that are available at professional photography supply retailers. You buy these by the sheet, but you only need to cut out a small portion to cover the tiny iSight lens.

Infrared Prototype 2

I could have simply used the remote that came with my iMac for the handheld input device, but I don't like how it blinks, plus I doubt its battery was meant to hold up to such long duration usage. Instead I made my own device using a 9 volt battery, an infrared LED and a couple of 68 ohm resistors connected in series with a 50 working mA current. I was pretty lazy and just taped/soldered all the parts together directly to the battery.

To do the input detection I at first attempted to write the application in ruby using RubyCocoa, but it turned out that there is a problem with it mangling the data from the camera (it mistakenly turns binary data from NSBitmapImageRep.bitmapData() into a ruby character string and there didn't seem to be any work around). So I ended up having to delve into Cocoa and Objective-C land for the first time. I've been exposed to a fair amount of computer languages in my life and Objective-C is easily the most bizarre and frustrating of all of them. It took me about 20 times longer to figure out how to accomplish simple tasks in Objective-C than it would have in C, C++, Java or ruby. The application uses the CocoaSequenceGrabber framework to read from the iSight camera. It then displays the live camera stream on the left and an x/y detection indicator on the right. You'll notice that the iSight flips the actual image, so I flip it back for the detection.

You can download the application here: Infrared Detector.dmg. It only works on a mac with a camera obviously. Follow the filter link above to get more details on obtaining the necessary filters, but you can sort of play with it without them if you put you finger over the isight camera so very little light comes in. The x/y location is determined as the first non-dark pixel the app runs across in the video stream.

Some future directions for this:

  • Make a better emitter device that includes a convex lens to spread out the infrared light better. Right now the LED is very narrowly focused so you have to be pointing it almost directly at the camera.
  • Hook the input into the mouse driver somehow. I'm not sure what to do about the mouse click. Perhaps I can use the microphone and just click my tongue (cluck?).
  • Look into gesture recognition possibilities.
  • Turn it into a "digital whiteboard" tool that will record pen movements as drawings. This can be done as you draw on an actual whiteboard.
  • Make an infrared LED 3D scanner input device. This will involve more LEDs, this time mounted around the camera and shining on objects in front of it. It will work by determining distance as a function of pixel brightness.

Post a new comment:

Thanks for signing in, . Now you can comment. (sign out)

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Remember me?