Digital Photo Editing in Processing

I finally got around to working more on photo editing in processing, and had some great results! I ended up with two separate algorithms for photo editing, which I call ‘differential’ and ‘threshold’.

The ‘differential’ algorithm starts on a row of pixels, and looks at the left neighbor of the pixel. It takes the color attribute of each pixel, and takes the difference (hence the name) of each pair of neighboring pixels. This difference is compared to a threshold value, and if the difference is great enough, the resulting pixel is colored black. If they are too similar, the entire screen is left white.

The ‘threshold’ algorithm takes the brightness attribute of each pixel and compares it to a threshold value. If it is greater than the threshold, the pixel is assigned the color black. Otherwise, it is white.

These algorithms result in images that are quite aesthetic. The differential algorithm tends to produce outlines of objects, while the threshold algorithm tends to create blobs that are the approximate size and shape of objects in the original photograph. Sometimes, however, I get images that are really quite abstract (these are among my favorites!).

I ran these algorithms on several photographs that Rachel Boyce took; I snagged them from her flickr photostream. A couple of my favorites are below:

Clouds (Differential)

Graffiti (Threshold)

Thorns (Threshold)

More of these images can be found on my Flickr. I’m hoping to make an openprocessing app out of these filters and release the code within a week.

A final thought: the threshold algorithm can be thought of as a ‘proportional’ algorithm because the new value is determined by the value of the old pixel itself. The differential algorithm can be thought of a ‘derivative’ algorithm because it determines the new pixel by how the old pixels are changing — essentially, by their derivative (large derivatives become black and small derivatives stay white). Could you develop a ‘integral’ algorithm to filter the photographs? What would it look like? This is another idea I’ll have to take a shot at.

[Note: I classify these under ‘generative art’ because it’s generating a new image using photographs to provide the seed information. True, it’s not purely generative — I am using a photograph as the base — but because the processing effort is algorithmic, I consider it generative.]

Advertisements

~ by asymptoticdesign on 12 January, 2012.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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: