Projection Mapping - now with video!

I've got the projection mapping code working quite well now, I'm in the process of building some classes to manage lots of projection surfaces at once in order to keep the code clean.  Since the last post I've also got video playback (live and pre-recorded) working nicely with this system.  Also, some fun example footage of the code in action! Here's an example of the calibration process, you can just drag the corners directly to the real-world points so it all lines up on the projector.  This is essentially the same calibration technique used in the keystone library with a few updates.  I've added a center point to drag the entire surface, and when you drag with the right mouse button it moves in 1/10th pixel increments for fine adjustments.

Here's the same content split up onto two surfaces and projected onto some random cardboard boxes I had in my office.

Projection Mapping in Processing

Projection mapping is something I've been waning to play with for a while now.  The biggest hurdle I've run into so far is compensating for distortion caused by surfaces that aren't perpendicular to the projector.  You can pre-render the video to counteract this effect, but for content generated in real-time (something needed for most interactive projects) you have to deal with this problem on the fly. After looking around I came across a library for Processing called keystone which sounded like exactly what I needed.  However, when I tried it out I noticed a critical flaw.  The library doesn't compensate for real perspective.  If you look at the image here, you can see that the vertical lines don't get closer together as they move further away.

cornerpin_problem.jpg

Since I want to project images that line up with real world objects, the keystone library won't work so I decided to try solving the problem myself.  After lots of reading and poking around on the internet, I've built the beginnings of my own projection mapping library.  Here's a shot of the same setup using my code instead of the keystone library.  You can see the difference immediately.

perspective_transform.jpg

My plan is to release this as a processing library once it's in a state that is easy to consume; right now it's just a handful of java classes in a processing sketch..

Gotta get yourself kinected

Picked up a refurbished kinect from Ye Olde Best Buy today. After many hours of frustration trying to get OpenNI working with my computer, I finally found a tip online that pointed me to a capitalization error in one of the environment variables..  SO, now that that's all sorted out, I can do fun stuff in processing like this:

kinect_test.jpg

My very early impressions of the hardware have been good so far.  The frame rates and latency of the 3d infrared camera are stunning, and the resolution of the depth sensing is way better than I was expecting.  I'm really excited to start exploring the OpenNI API's to see what sort of interesting things can be done.

The tale of the failed hard drive

Hard drive failure: the thing we all dread and often don't prepare for.  Well, it happened to me the other day.  Ironically, the drive in question is the one I use for backups.  It's a one TB seagate and on that fateful day it decided that all it wanted to do was spin up, make some "head seeking" sounds, then spin down.  Over and over again.  Not good. I decided to see if there were any simple solutions to be found on the internet, like putting a frozen halibut portion on it for a while or something.  After lots of googlification I found that there were at least some things I could at least attempt before giving up.

What I found was that seagate drives have a little four pin header on the back, and three of those pins will happily talk to you over TTL if you have the right hardware.  It just so happens that I have a usb to TTL adapter which I use to program my arduino mini.  Using the adapter and some hastily soldered jumper wires, I hooked it up.  If you look carefully at the photo, you'll see my backup plan (red wine) in the event that I was unsuccessful.

hard drive fix

After using a spare PC for the power supply, I was able to get the drive to talk to me over hyperterminal!  Through the serial connection you can issue all sorts of low-level commands to the drive and get lots of awesome diagnostic information instead of just preventing your computer from getting beyond POST.  From the terminal connection, I was able to wipe out the S.M.A.R.T. data and rebuild the partition information by having the drive scan itself.

Terminal Window

This whole process only took only an hour or so, and I am happy to say that the drive is now completely functional and I got all of my data back!! Hooray!

For anyone interested, my drive is a 1 TB seagate, model ST31000333AS with the SD35 revision firmware and I found this forum post to be extremely helpful.