Photo Editing in Processing

In the past, I’ve toyed with laser etching patterns onto clear acrylic and then lighting up the patterns with LEDs. The process gives rise to an image that appears to glow while embedded in clear plastic:

Initial Concept

The visual effect is quite pleasing, but I quickly ran out of ideas for things to etch into the acrylic. Sure, I could tons of stuff with vector graphics, but none of it really stood out from the rest in a way that I liked. But recently, inspirations truck! I had the idea to turn photographs into laser etchings and light those up. Of course, this meant that I had to find a clever way to convert the images into 2 or 3 colors that I could easily raster etch or vector cut into acrylic.

Given that I’ve been playing with Processing a lot lately, it seemed like the natural tool to use.



The algorithm is pretty simple: for every pixel, compare it to its neighbor to the right. Subtract the R,G,B values of the next pixel from the current pixel:

Current Red – Right Red = New Red
Current Green – Right Green = New Green
Current Blue – Right Blue = New Blue

The new red, blue, and green values are then used to color the pixels. This creates a reasonably effective edge-finding algorithm — the pixels are brightest where the largest change occurs between two pixels; near the edge of a shape! And thus I can get images that approximate outlines of the objects in the picture.

I’m actually really pleased with the results independent of how they turn out laser etched in acrylic; the greyscaling of the photograph is really aesthetically pleasing. On my to-do list is to clean up the noise a bit so that there’s less pixels randomly scattered around the image — a simple threshold filter (if the pixel value is less than a threshold filter, remove the pixel) didn’t do what I wanted, so I’ll have to come up with a fancier algorithm.

Next time I’ll post the code and the algorithm run on more pictures!


~ by asymptoticdesign on 8 December, 2011.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: