Valentine’s Day 2014: Wood Carving

This year’s Valentine’s day video is going to be a little short, I’m afraid. Over the past three weeks or so, I’ve been playing with several ideas. My main goal was to have decent, full HD video for my video, since I found the video quality in my previous videos somewhat lacking. Since I didn’t have much luck finding a decent video camera to use, I decided that a still camera would have to do. Raspberry Pi in hand, I set about creating a time-lapse rig using my dad’s DSLR camera.

Raspberry Pi


It turns out that there’s a great camera control library called gphoto2, which will not only download videos from a variety of cameras, but is also capable of controlling the shutter on many Canon and some Nikon cameras. Once I had that installed, creating time-lapse videos was a fairly simple matter of one command: watch -n 10 gphoto2 –capture-image. This captures one picture every 10 seconds. My first test, watching an ice-cube melt, went pretty well, despite the fact that the tripod was a bit shaky.

In the end, I didn’t have time to build a power pack for the Raspberry Pi, so I couldn’t film without a power outlet, which is inconvenient to say the least. So, in the end, I decided to record a time-lapse video of my carving a piece of wood. Bare in mind, this is the first thing I have carved EVER. So it’s not that great, but the video is cool, at least.  It took me about an hour and 15 minutes to carve out the drawing I made.

The final obstacle was that Adobe Premiere decided that it couldn’t possibly load any video format that I threw at it, so unfortunately I couldn’t edit the video at all. so there’s a single picture at the bottom of this post showing the final result.

So, without further ado, here’s your moment of zen:

Finished Carving


Valentine’s Day 2013: What Twitter Thinks About Love

Every year, I create some sort of computer art project for Valentine’s Day. This year, I created another video, and I think this may be the coolest one yet.

Two years ago, my video was an attempt at capturing the spirit of valentine’s day by processing a video I took on my bus ride to school. I wanted to go back to that theme this year, but the whole “searching for colors thing” was played out. This year, I decided to get my computer to describe love.

Basically, I had my computer suck down every tweet on Twitter for a certain time period that had the word “love” in it, and then processed it, looking for the most common chains of words. I did this using a method called Bigram Probability, which basically calculates the probability of one word coming after another in a sentence. The more often the word “you” comes after the word “love”, the higher the probability assigned to the word “you” coming after “love.” It’s simple enough, but it produced some beautiful results.

Because of this method’s simplicity, I had to do a little “post processing,” which involved taking out the garbage sentences that the program produced. In the end, this became “picking the good ones.” Now, that’s not to say that I’m only picking the cute ones. No no, I’m picking the ones that are grammatically correct; the computer is doing the cute all by itself. Or rather, Twitter is.

Then I shot some video of a hike to the top of the mountain (story after the video,) added the text over it, and set the whole thing to some awesome music by Broke For Free that I found on Free Music

Before we get to the video, let’s have some stats. Of all the words the computer processed, the most common (other than love, which was the search query,) was “I”, and the next most common was “you.” Starting with “I”, the sentence with the highest probability was “I love you”. (D’awwwww.) The most common word after “you” was “love,” but if we ignore that one (because it creates an infinitely cute loop of infinite “love you”s),* the next most common sentence was “I love you too.” And if you think it’s cute that the sentences with the highest probability resulting from a search for the word “love” on Twitter are “I love you” and “I love you too,” wait until you see the ones I used in the video.

Note that the video is a bit shaky. If I had a better camera and/or a Steadycam, I might have been able to record more stable footage, and track the text better. The music is by Broke for Free.

A Story

As I walked up the mountain, I was honestly worried that the video would be a little boring. The computery stuff is cool, and I love playing with video editing sofware, but my idea for the background footage seemed a bit boring. Fate brought me the heart-shaped balloons in the trees, which I thought was a pretty cool end to my journey. But actually, that was the beginning of a different, far more exciting journey.

Coming from the direction of the heart-shaped balloons (make of that, symbolically speaking, what you will,) I heard the song “If I Had a Million Dollars” by the Barenaked Ladies. It seemed to be coming from the woods, but I had no idea who would be playing music that loudly near the park. I thought about trying to find it, and then decided against it. As I was leaving the great patio that forms the lookout on the mountain, something turned me back. Where’s my spirit of adventure, I thought to myself. So I turned about face, and I went in search of the music.

Because I value the integrity of my limbs, I decided against filming my hike through the woods and snow, which took place entirely off the paths in the park that are maintained during the winter (the first thing I did was boot-ski down a staircase that was “closed for the winter”) and mostly off the few paths beaten into the snow by other daring travelers.

I ran through the woods, slid down slopes, and hung on to trees. It was an exhilarating feeling. I’ve always loved running through the woods, and I haven’t done it in a long time. Every so often I would stop, prick my ears, and listen for the music. Sometimes it would fade out, and I had to try to head toward where I thought it had been the last time. My best guess is that someone had set up an outdoor skating rink, as towns and schools commonly do in Quebec during the winter, and that they were playing music for people skate to. But I didn’t come across a skating rink.

Eventually, I reached the road. There was no sign of the music, or where it was coming from. I knew where I was, and I had an appointment in an hour and a half, and I thought I’d head back. The adventure was fun, and I had gotten something out of my search, even if I hadn’t solved my puzzle. So I started walking home, and after a block or so, the music piped up again. It was louder this time. I could tell that it was bouncing off the buildings, so it was hard to say exactly where it was coming from. I hesitated, then took my best guess and started after it again. As I walked down the street, the music got louder, and louder, and louder, until I could finally see where it was coming from.

It was coming from a protest at the Montreal General Hospital. One of the unions there is on strike, and they were picketing and playing music. My mystery music was coming from an amp strapped to the back of a pickup truck. The mystery was solved.

It’s amazing how, sometimes, if you look hard enough, life gives you exactly what you want. I was cranky that day, my mood sharpened by not wanting to get out of bed, and my usual frustration with the commercial assumption that all people everywhere are paired off on Valentine’s Day. Something was telling me, right before I had started my trek, that life was holding out exactly what I needed at that moment. And whether you believe in fate, God, synchronicity, or probability, I felt that one or all of them were giving me an opportunity; a free pass to improve my mood and learn something.

The lesson I learned (or relearned) is this: what you’re looking for is out there somewhere. It applies very well to those of us who are single during this season, and to love, but it also applies more generally to any other pursuit in life. You’ll hit rough patches, you’ll get lost, you’ll have fun, you’ll face adversity, and maybe you’ll even give up a few times, but if you keep your ear to the ground and your goal in mind, you’ll find what you’re looking for eventually.

*Those familiar with bigram probabilities will probably realize that there shouldn’t be repeats. However, the data structure I used to store the bigram probabilities made the usual manner of iteration somewhat difficult, and I wanted to allow some repeats.

Valentine’s Day: Musical Hearts

Here it is, ladies and gentlemen: this year’s Valentine’s Day computer art project. For the past two years, I’ve done some sort of computer art project for Valentine’s Day. The first was a 3D printed heart with a red LED inside. Last year, I recorded my entire bus trip to school, and wrote a program to select only frames with a certain amount of red in them, and compile them into a video. This year’s project was slightly more ambitious.

My original idea was to take videos of artistically interesting things on my walk to school. A computer program would then find trackable points on the video, and “stick” hearts to those objects. The sizes of the hearts would correspond to the amplitudes of certain frequency ranges in a song that would play in the background… a song which I would compose and create on my computer.

Several factors led to my cutting out the motion tracking entirely (namely that OpenCV is complicated, and Adobe After Effects hates me.) However, the hearts respond to the sound of a song that I composed and performed using ChucK, which is a programming language for creating sound. If you hadn’t already guessed, the red heart is low frequency, pink is midrange, and white/light pink is high. While the result isn’t nearly as cool as my original idea would have been, I think it’s pretty nifty, and it was fun to make. I also learned about some valuable tools in Processing.

To record the videos, I walked from Westmount to McGill at 7:40am, in -15 degree weather, without gloves. When I got to McGill, I could hardly feel my hands. So it’s safe to say that I put a lot of effort into this video.

(There was initially a problem with the upload, which has now been corrected.)

For the sake of comparison, for last year’s video I used two programs, one of which I wrote myself (Cinelerra and a python script for selecting video frames based on color composition.) For this year’s video, I used a grand total of 8. In order of usage (more or less:) ChucK, miniAudicle, Sound Flower, Audacity, Processing, Adobe After Effects, and Adobe Premiere*, and a Java program that I wrote in Processing.

*I am currently upset with Adobe. As a student, I cannot afford a license for the Adobe Creative Suite; a marvelous collection of software. I also have no intention or ability to make a profit from the work I have would do with the Creative Suite. If I spent my free time playing with Photoshop, After Effects, and all the other neat programs on my own computer, however, I might be able to make money from my work some day, at which point I would buy the Creative Suite so I could profit from my art. On the other hand, there isn’t a chance in hell I’m going to spend $899 on the Master Collection just to tinker. Therefore, it’s in Adobe’s best interest to offer a FREE (as in beer) version of the Master Collection to students for strictly non-profit, educational use. So there, Adobe, the ball is in your court now.

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.

Valentines’ Day

An Image of a heart

A Makerbotted LED heart.

You may have noticed something unusual about the title of this post: the apostrophe comes after the s, when it normally comes before. Don’t worry if you missed it, it’s subtle. But the difference between the two is enormous. Valentine’s day is a holiday, typically attributed to St. Valentine – thus: the day of St. Valentine. However, Valentines’ day has a different meaning. Valentines’ day is the day of Valentines. It’s for them, of them, and about them. And today I’m going to talk about the rest of us.

There are plenty of us in the world for whom Valentines’ day is a bit of a waste. It crops up once a year as slightly painful reminder to those of us without “Valentines” that we’re alone, once again, during Valentins’ day. Before you get the wrong idea, this post is not about how to make heartache go away. This post is about how to deal with heartache.

The problem with heartache is that it kicks you when you’re down. I’ve always found that the absolute worst time for heartache is after 12am. You’re lying in bed, trying to go to sleep, and suddenly it hits you – you’re alone. The empty space next to you in bed feels so empty, and there’s nothing you can do to fill it. For a headache you can take Ibuprofen, for indigestion you can take ant-acids, for exhaustion you sleep, for hunger you eat, for thirst you drink, and for miscellaneous physical pain you go to the doctor – but this isn’t any normal kind of pain. It’s a pain that can’t be cured or even influenced by anything you can do immediately, and that’s what’s so difficult about it. Continue reading