Wednesday, November 12, 2008

Drawing pictures with diffusion-limited aggregation from Kevin Atkinson on Vimeo.

I've wanted to try this idea for a while, so here's a quick-and-dirty version. I'd like to revisit it and do it properly sometime.

The idea is: make a picture using diffusion-limited aggregation. The code and technique I used is the cheesiest of quick hacks, but the results are really encouraging.

The pictures are nice, but most of the fun is watching them develop. So here are some movies of the process, each with slightly different settings:

First movie.
Second movie.
Third movie.

Sunday, November 09, 2008

Here is the calibration target scanning code. It is a VC Express project, though all the code should be portable.
Update: The checkerboard scanning code is here.

I've been working on computer-vision-y stuff rather than visual-effects/art-y stuff lately, and I thought I'd share the fruits of my labour with the geekier contingent of the 3 or so people who read this blog.

I use OpenCV a lot in my work, and it is a wonderful toolset indeed, except I've always been irritated by the limitations of its calibration target scanner. Bafflingly, it requires the entire target to be visible in the image, which makes it difficult to get good image coverage for lens distortion estimation. My hunch is that a good camera calibration requires data from all parts of the image, which is difficult to do when if you even slightly clip one corner of the target, the scan fails.

Another limitation is that the target (a black and white checkerboard) has no fiducial markings to indicate the origin of its coordinate system, which is problematic in some applications (it caused major ass pain when I was developing a vision-guided robotics application).

So I wrote a target scanner which overcomes those limitations. It will scan as much or as little of the target that is in view, and supports targets of up to 32x64 squares, which should be plenty.

I'm preparing a source release, which will be ready shortly. It will include a python script which uses pycairo to generate pdf files of the target.

The scanner knows where it is in the target coordinate system by the special codes in the centers of the squares. It's a simple little 2d code of my own devising which encodes the x,y position of the square plus a 3-bit checksum.

It's pretty quick, too: it takes about a 20th of a second to scan a 640x480 image, on my under-powered laptop.