We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexDiscussionExhibition › Four Winds: image mutator
Page Index Toggle Pages: 1
Four Winds: image mutator (Read 1583 times)
Four Winds: image mutator
May 3rd, 2010, 9:25pm
 
Hi there... here's a program I just wrote which creates evolving abstract compositions from an initial seed photograph.

It starts with an image and pushes the colours around to create an evolving series of abstract compositions. It will evolve continuously from a single image if you just leave it to run. It uses four different drawing methods which push the colours around in different ways according to their hues and the internal "clock" time of the program.

http://www.openprocessing.org/visuals/?visualID=9422
Re: Four Winds: image mutator
Reply #1 - May 5th, 2010, 12:50pm
 
Very nice. The first few seconds of the mutation makes the image like an oil painting (sorry I'm not good at drawing). It reminds me of some filters that you can use in adobe photoshop to make a photo look like a painting.
Re: Four Winds: image mutator
Reply #2 - May 5th, 2010, 8:29pm
 
Thanks...

It's more interesting if you leave it longer - it really does go through many different phases of composition - areas of colour are built up, broken down, spread around,  drawn in different textures, and so on. The image is just there to provide some sort of "seed" for the evolutionary process, a bunch of patches of starting colours.

(Well, this is what I find interesting anyway - I'm interested in abstraction that evolves over time).
Re: Four Winds: image mutator
Reply #3 - May 6th, 2010, 11:40am
 
Hey, it's cool, but you should know it's kind of slow on an older machine (1.33 Ghz in my case).  Are you modifying the pixels[] array directly?  If you use loadPixels/updatePixels, even with offscreen buffers, it'll be much faster...
Re: Four Winds: image mutator
Reply #4 - May 6th, 2010, 12:24pm
 
Well, I consider my computer to be pretty slow by today's standards (an AMD dual core 2.0GHz with only 512k L2 cache per core). And it runs OK on here.

Having said that, I am interested in optimising any way I can. One of the more demanding methods is a "recursive blob" -which draws a pixel in the blob colour and then randoms draws adjacent pixels in the same colour recursively. Setting the recursion depth and the probability of adjacent pixels being drawn affect the size of the blob and how porous or solid it is respectively. In the program this is just used to draw irregularly shaped patches of colour.

I use set(x, y, color) to draw each pixel every time the recursive method is called. I tried changing this so that instead I call loadPixels() before I call the recursive method, and use  pixels[ypos+width*xpos]=colour in the recursive method, and then call updatePixels() after exiting the recursive method. But this is way, way slower.

Other methods draw very small ellipses or rects - could possibly be optimised too. I'd love to hear any suggestions (source is at openprocessing - link above).
Re: Four Winds: image mutator
Reply #5 - May 6th, 2010, 12:35pm
 
Welp, the slowdown with loadpixels/updatepixels typically only happens for me if I am performing updatePixels() multiple times per frame (e.g., god forbid, each time I change a pixel!)  -- but it ideally looks like this:

void draw(){
 loadPixels();
  //make all changes to pixel array, run loops, etc.
 updatePixels();
}

and should be pretty speedy.
Re: Four Winds: image mutator
Reply #6 - May 6th, 2010, 12:46pm
 
Yep, I did that...called loadPixels() before I even called the recursive method to make sure it wouldn't do it multiple times. Called it in setup(), so only called once. Called updatePixels() afterwards. Still much slower... I can post the recursive blob method if you want to try it for yourself (not to prove my point, but I may be doing something wrong).

Page Index Toggle Pages: 1