Sunday, November 9, 2008

Video desktop: an experiment with user interfaces

So, this weekend my new webcam finally arrived! By webcam standards, it's pretty cheap, but it's enough for my purposes.

But maybe I should back up first, and explain. I have wanted a HMD for a while now, but jeez, those things are expensive. >_< Maybe someday I will stumble upon a bag of money in the street, and if that ever happens, I know what I'll be buying first. I still intend to get one someday, though, so I've actually given some thought to the problems you would have while using one. One problem that you have with them is opacity - When you're wearing the HMD, you can't really see anything else, which limits their usability. The obvious solution, then, is to hook up a camera to the HMD, and have it show you what you would normally see, in addition to whatever you're doing.

Being the kind of guy I am, I decided that that seemed like a worthwhile weekend project. :3

Obstacle 1: Video input. A quick trip to newegg fixed that - I got a $20 USB webcam, and a USB hub which will also be handy for other stuff. Getting it working under linux was less of a pain than I thought it'd be; the linux-uvc driver supports the webcam just fine, and took all of a minute to install. (Dear Microsoft: You could learn a thing or two from Linux about software installation.)

The permissions on the video device were pretty restrictive initially, but a quick chmod fixed that. After that, I pointed the camera out my window and watched the video stream from the webcam with mplayer, which was all I really needed to check that it worked. The video is really noisy, probably since it's not exactly a high-end webcam, but mplayer has filters that can mitigate that if it bothers you.

Obstacle 2: Desktop video. This was much easier than it could have been, thanks entirely to the xwinwrap utility written by David Reveman, who is kind of a badass. For the curious, the script I'm using to start it looks like this:

#FILTERS="-vf hqdn3d=4:3:16:16,decimate"
./xwinwrap -ni -fs -s -st -sp -b -nf -- mplayer -wid WID -quiet $FILTERS tv://
With this, I have the output from my webcam rendering directly to my desktop background.

Obstacle 3: Window opacity. You may be wondering, what good is having a video desktop if you can never see what's on it? Luckily, compiz comes in here and saves the day. Compiz has a plugin that allows you to change the opacity of any window, which is dubiously useful in most cases (other than looking cool) but is seriously useful here. With opacity around 90% windows are still pretty usable, but I can kind of see through them in low-complexity areas (like the white space to the left of the input box on Blogger).

The end result of all this: As I am typing these words, there is somebody riding a bike through this blog post. :D

I think the thing that surprised me most about this project was how easy it was to set up - from the moment I opened the webcam box, to watching cars drive by on my desktop, took almost exactly half an hour. Personally, I blame Linux - if it weren't so darn easy to use, this project could have taken longer. :/


Kiriska said...

lol. Nice. :P

Now do the same thing on your Windows laptop. :D (And learn me how to do it because I have a webcam sitting in a box that I never use; I could be spying on neighbors instead!)

Kiriska said...

You missed a day! D: