Emergency Exit


CokeTunes

Posted in Development by McZonk on the April 17th, 2008

Coke + iTunes

Inside of very german Coca Cola cap is a code to download a fourth iTunes song, so 4 caps = 1 song. I do not drink coke, but my brothers have a high Coca Cola consumption. Manually type in all the codes is very annoying and I always wanted to do some research in image recognition. So I have written some code to automatically detect the key inside the cap.

Step 1 - Original ImageStep 2 - Detect Center

Step 3 - Gray ScaleStep 4 - Adjust Brightness

The first problem is take a good image. I made a mark on my desk where to put the cap. The code has to be in the upper part of the image. The next step is to find the center and crop the image. This is done with simple pattern matching of a mask. Removing the colors and adjust the brightness is a simple batch job.Arrange the code in a straight line is done by a simple program I have written with OpenGL. It uses the image as a texture and draws a quad strip with circular texture coordinates.

Step 7 - Arrange in a line

In the end I pass the final image to an open source OCR tool. At the moment the recognition rate is around 50%. But maybe I can improve this.

Coke Caps

P.S.: The pictured codes are unused. So this is your chance to get a free song.