i am hari. an interaction and service designer based in copenhagen, dk. here is my portfolio and blog. i draw, design, make and ride motor bikes.

Particle systems and rule based contour finding in an Image

How would a swarm of particles with a few rules traverse a picture?

Portrait of Dr. Gachet, 1890, Vincent Van Gogh

I started this project as part of a series of experiments exploring swarm behaviour and micro world simulation. Similar to the earlier project, the particles behave according to a few simple rules, and a base image to traverse on. The direction and speed of the movement of each particle is dependent on its immediate past and its current position in the image.

The video above shows such a swarm traversing Van Gogh’s “Painter on the Road to Tarascon“. The swarm’s initial points are along the top edge of the painting (in fact, there are twice the amount of particles as the width of the image.). In this case the particles penetrates to almost half of the image and then either expire or end up outside the image’s boundaries.

Portrait of Daniel-Henry Kahnweiler, Pablo Picasso

Hard features in an image causes a sharp change in direction of the particle swarm, while the effect of softer, gradual changes in the image, on the particles are also subtle.

The rules

The swarm behaves strictly according to a rule-set –i.e. no random factors. Every time swarm runs on the same image, if the initial conditions are set, would generate the same image output.

  • Compare own colour with the colour of the pixel in the image at current position
    • Calculate the direction according to the hue.
    • Calculate the velocity according to the change in luminance.
  • Replace own colour with the colour of the pixel in the image at current position
  • Proceed to the next point in the image (according to calculated direction and velocity as in the first step)
  • Repeat.

Self-Portrait, Spring 1887, Vincent Van Gogh

The initial conditions that affect the generated output include the dimensions of the source image, origin and initial direction. The picture generated is a composite of the colours of all particles from start to the end. Or as in the above image, the brightness. (the particles still move according to the hue rule as above.)

Bedroom in Arles, 1888, Vincent Van Gogh

Self-portrait, 1889, Vincent Van Gogh