Tuesday, October 7, 2008

Edge detection in Processing.

Adblock
Adblock

ballEdgeDetect01
Originally uploaded by warpcat
After a few month hiatus (darn that Python), I thought I'd get back into Processing. Taking an old sketch, I wanted to try a few things: Simple motion in a confined space, and edge detection of colliding volumes. I solved the issue of edge detection by code found in "Processing - A Programming Handbook for Visual Designers and Artists" (by Casey Reas and Ben Fry, good book) dealing with 'convolution'. If you're interested in that convolution code, you can find it here (Unit 40 (Image 5), example 12) . My first crack at it, but it pulled off the effect I wanted perfectly. However, this only gave a very thin edge as a result. I wanted the edge larger. To pull this off, I ran a blur filter, then a threshold filter to blast out the blur to pure white and black, then another blur on top of that. The sketch got pretty slow, about 1 fps on my older laptop. For the motion, the circles get smaller as they move to the left of the image, and larger as they move to the right. Some circles are solid, while others have the opposite fill, givng them a donut effect, and I think providing a more interesting look overall as opposing values collide.

I was going to post the source for this, but my Processing Wiki currently isn't letting me update it... frustrating.

No comments: