Work In Progress: Look at you

2009 June 02

Long time, no post. I haven't given up, I've just been too tired to do anything worth sharing. But, recently I got an idea in my head for a website. Part of it involves making animated gifs from webcam data. I found the GifPlayer package on http://bytearray.org/?p=95 which works wonderfully. The only problem was that the color quantizer was using a fancy neural net algorithm which, while it produced great results, was way too slow for near real-time use.

So I implemented a median-cut quantizer. I based it off of an old dr. dobbs article http://www.ddj.com/184409309?pgno=24

The idea is pretty simple, it divides the color space into smaller and smaller "cubes" recursively, always along the widest color dimension. This results in a palette which provides quite good fidelity, and is much quicker than the neural net quantization that the GifEncoder originally used.

My stuff uses a slightly different signature, so I had to create a new GifEncoder class to use it. I'd have made an interface and had both just be Quantizers, but the NeuQuant class is quite confusing.

Anyway, code: GifPlayer and Reaction Capture

Basically, this loads up, accesses the webcam and takes a snapshot every 5 seconds. After 4 shots, it's done. You can save your gif or try again. This is only a proof of concept while I work on the full idea.

privacy policy
Sponsored links