Transform Power Go!

Andrew's Time Lapse ImagesAndrew's Time Lapse Averages
Inspired by an online video, I decided to take a picture of myself every day. There’s a camera built into the lid of my MacBook Pro, so I wrote some programs to make the job easier, and now every day that I remember I snap an image; I’ve remembered about 250 days in the last 300. I decided to make a video of all the images in sequence, so I ran them through a Photoshop action to normalize the colors and contrast, made a movie from them, and watched it. Even though I tried to hold my head the same way in every picture, my face still jumped around way too much for continuity.

So I figured, hey, I’m a math nerd! With a little linear algebra I can create an affine transformation for each image so that both eyes always appear in the same place. I was going to write a face-recognition package to find the eyes, but my friend Steve observed it would be easier to do it manually. So I wrote a program in Processing that put up each image and captured three mouse clicks, one in the center of each eyeball and one at the base of my nose. I also wrote a quick 2D matrix and vector manipulation library. For each picture, I used the mouse clicks to calculate the appropriate transformation matrix, inverted it, and used it to redraw the image so these three points would always land in the same spots. The results were awful! It turns out the MacBook Pro uses a pretty wide-angle lens, which is great, but it meant that when my head was off-axis or tilted, the affine map could shear or squash my head almost comically, looking like an overcooked hotdog flopping around. I thought I was stuck.

But then I figured, hey, I’m a math nerd! I wrote some code to compute a special-purpose transform using only a rigid transform and uniform scaling. I then used just the eyeball positions to compute the transform for each image. Success! Above you can see the averages of the first 50 images and the last 50 (I grew a beard). The resulting time-lapse-ish video is kind of fun to watch (click here), though YouTube’s compression is pretty extreme. Computer graphics has really come of age. Now we can have an idea for a project like this in the late afternoon and then write the code, apply it, pick a whole new approach, write the new code, apply it, and be done before The Daily Show at 11pm.

Update: My friend EricH suggested making a video of the averaged images. Good idea! So here’s a new video, where each frame is the average of that daily image and the 49 that follow it. Click here to see my beard grow!

A 12-Step Program For NPR

It’s pledge week again on NPR, and my radio is full of people begging for money. I feel for them, since I did on-air fundraising myself for years on college radio (we weren’t NPR, but our financial model was the same). Nobody likes begging for money. In fact, most on-air hosts dislike pledge week even more than the audience, but like a recurrent case of herpes it breaks out twice a year, and then everyone has to deal with it. Because I feel their pain from my own experience, and because I listen to NPR, I’ve been a regular contributor. But I don’t think I’m going to give this year.

In terms of business models, public broadcasting is a drunk, and people who give them money are enablers. American public broadcasting (NPR on radio and PBS on TV) runs partly on endowments and corporate gifts, but they also depend on contributions raised during these on-air beg-a-thons. All non-profits need to solicit donations, but this particular approach is riddled with problems, not the least of which is that the broadcasters hold their own programming hostage to encourage donations. They also regularly indulge in a variety of half-truth come-ons (e.g., by giving money during a given show you’re implicitly saying that it’s your favorite). It’s not unreasonable for NPR and PBS to use their own communications channels to raise money, but these week-long passive-aggressive guilt trips have got to end. Public broadcasters are smart; they’ll find other ways to raise money if this approach dries up. Let’s do everyone a favor and dry it up fast. When they decide to stop being obnoxious about their fundraising, then we can start donating again.

So the next time NPR or PBS interrupts their own programming to beg for more money, show them that you really care by not enabling their self-destructive business model. Give nothing, and help them break their addiction to these awful pledge drives.

My Weighted Companion

Andrew's Weighted Companion Cube
The Weighted Companion Cube appears only once in the brilliantly-written game Portal, but it has become a web phenomenon. I want to get a dog, but I thought this might do in the meantime, so I grabbed some screenshots, and then spent a happy afternoon turning some old corrugated cardboard, masking tape, and colored paper into a model of my bulky, conscientious comrade.