Monthly Archives: February 2008


If you don’t read xkcd every Monday, Wednesday, and Friday, you’re ruining your life.

I don’t get to drum anymore, but this is still hilarious…

You can identify them ahead of time — they lead with their left foot when the music starts.

Latest Programming Accomplishment: Picture Processor

I just wanted a brief, self-congratulatory post since I finished my CS 559 graphics program that I mentioned a night or two ago. It works pretty dang sweet, and despite the fact that a “couple” other programs out there already do this stuff and a heck of a lot more (like, oh, Photoshop, The GIMP, etc), I’m still pretty proud to say that 100% of the code that made these pictures was written by me 🙂

Definitely look at these at their full size (click on them), they’re not very impressive as thumbnails. (And that spin one is not impressive ever, but that’s ok. It serves a different purpose.)

Pictures Created By Me

  1. Assignment: Create an image of yourself in a place you’ve never been. Of course, I am a nerd, and a huge fan of a particular movie. So the logical conclusion:
    A Place I've Never Been: In the Matrix
  2. Demonstrate Sharpening and Blurring. I turn to everyone’s favorite College of Engineering icon, incidentally covered in a light bit of ice, courtesy of Enlight:
    Sharpening & Blurring
  3. Demonstrate Image Rotation and Composition. I took a red checkerboard background, created an image of a single line, and then made lots of rotated copies of it:
  4. Demonstrate Nonphotorealistic / “Painterly” Rendering. Once again, our favorite College of Engineering icon jumps in as a model. The top picture is the original, the bottom left is the painting type we were required to do (circle brushes), and the bottom right is an extra painting type that I created (custom brush, in this case, an X shape).
    Painterly Rendering

Saturday Leisure Activity: Parallel Kingdom Beta Testing

In between fits of graphics programming today, I had a pretty neat opportunity to beta test a game that some friends of mine are developing for Google’s Android software platform. The game is called Parallel Kingdom, and is based on the idea of using the GPS in the Android phones to play a medieval MMORPG in a virtual world that mirrors the real world.

What does that mean? Well, for example, in one round of beta testing, Jason built a castle on Capitol Square, while Jon set up shop at Camp Randall. I got too close, and got killed 😛 In the virtual world, we got to craft weapons, build buildings, and run around attacking eachother, which will ultimately happen out in real life. Check out their first video, for a sweet example!

I’m looking forward to seeing this progress; they’ve got a lot of really great ideas!

A Gallery of Ways Not to Resize Images

So for CS 559: Computer Graphics, our first project is to implement a program that can do various things to images. For instance, we need to turn color images to gray scale (or part way there), resize them, rotate them, etc.

As it turns out, the mathematics behind some of these things that we take for granted in Photoshop or the GIMP are actually fairly complex, though I don’t want to get into them now. What I do want to show you are several ways that one (say, me) could try to implement a simple “resize” operation and fail, due to tiny little bugs:

How to Screw Up the “Resize” Function, in Pictures

  1. (First off, here’s the original, full size image. Click for a larger view. Each attempt below was to make it 2/3 size.)
    Original image
  2. Use < where you meant <= to define your resampling filter. (Causes the filter not to include certain values that are exactly on the edge, like, say, all the exact integer multiples):
    Less-than vs Less-than-or-equal
  3. Use an unsigned char instead of an int to store your y coordinate index. (unsigned char‘s can only hold the numbers 0 to 255, whereas ints can hold +/- 2 billion):
    Use char instead of int
  4. Cast float to unsigned char after using a filter not guaranteed not to amplify values. This one is pretty subtle, but you can see red & yellow splotches appear on the shirt (e.g., dots on my left shoulder), and my right ear has holes in it. Very annoying. (If the filter amplifies values, then it can output, say “257” from inputs ranging 0-255. When you try to fit “257” in an unsigned char, you get overflow and the output becomes “2”.)
    Amplifying Filter + direct cast to char

Electric Sheep

I just found this awesome screensaver / distributed computing project today called Electric Sheep. In short, it’s a screensaver that shows you awesome animations while using your idle CPU to create new ones in the background.

Here’s a couple sample images:


(Images by Scott Draves and the Electric Sheep)

Why “Electric Sheep”?

An homage, it turns out:

The result is a collective “android dream”, an homage to Philip K. Dick’s novel Do Androids Dream of Electric Sheep?

More Background

They have screensavers written for Windows, Linux, and Mac platforms, where the idea is to create some pretty awesome art while your computer is in screensaver mode. When the screensaver is active, it downloads recently completed “sheep” (high-quality MPEGs) from the sheep server, and displays them for your viewing pleasure. Meanwhile, in the background, it also downloads some XML data sets to run through an algorithm which creates frames for these “sheep”. When the frames are done, it sends them to the sheep server. Ultimately, your computer contributes to creating new art while showing you the current stuff!

Behind the scenes, the screensaver is running code called Flam3, to create “Cosmic Recursive Fractal Flames”, and smooth animations between them. A human designer, using one of the tools available at that site, describes the fractal they want. Then, the Electric Sheep in the distributed computing network crunch the numbers to generate intermediate animation frames.

Very Cool.

It's a long story.

Cop Car Back Seat.jpg

There are no seatbelts and no leg room in the back of a squad car.

[Update 2-12-2008 02:37: As Jason notes, it would probably be appropriate for me to mention that we did not, in fact, get arrested. Though it was really fun to post that from my phone 🙂 In reality, the officer was keeping us warm in his squad car while we waited for a tow truck to arrive to pull Ashley’s poor Beetle to a mechanic for a little TLC. So no crazy arrest story… sorry! Just a tiny bit of good luck in an otherwise pretty rough day, in that we happened to break down in a tiny patch of “The Middle Of Nowhere” that actually had cellular reception. [/Update]