Happy Valentine’s Day: Computer Processed Love

For whatever reason, despite the fact that I’m not sure whether I like or dislike Valentines Day, I like to write a relevant post on the 14th of February. All this month I’ve been trying to come up with something to post about, but couldn’t really think of anything interesting. Finally, right before I went to bed last night, I had an idea. Every morning, I ride the 24 bus down to McGill through downtown Montreal. Being a fairly large city, I figured there would be plenty of Valentine’s decorations littered throughout the city. And since I’ve been playing around with image processing in Python, specifically extracting and analyzing the colors of images, why not swirl this into some sort of video project? I decided to record a video of the down-town portion of my bus ride, convert the videos into a sequence of jpeg images, select only the images with a certain density of red, and recompile it into a Valentine’s Day montage of sorts, with the hope that my algorithm would pick out most of the Valentine’s stuff, as well as some interestingly non-Valentine’s stuff.

Unfortunately it was raining, and the windows of the bus were a bit dirty, but I think the result is pretty cool. Enjoy, and Happy Valentine’s Day!

For those who are curious about how the program works, it calculates how many red pixels (a high red value, low green value, and low blue value) there are and “how red” they are, and only takes images with a certain value or higher. I used Python and the Python Imaging Library. I made two silly mistakes: 1) I used an iPhone camera, which isn’t terrible, but even the video feature on my still camera would probably have been higher quality, and 2) I had the phone turned vertically and now the aspect ratio is all weird! I flipped the video the right way round, but it still bugs me a bit.  PS: I cheated for one set of images. If you can find it or guess which it is, you get a virtual cookie.

Advertisements

One thought on “Happy Valentine’s Day: Computer Processed Love

  1. Pingback: Valentine’s Day: Musical Hearts « Worldgnat

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s