Posted by: pixelero | February 27, 2009

Voronoi XYRGB

It started with a idea of writing a posterizer – or in this case a ‘Obamizer’:

Main principle is to compare each color’s distance in rgb-space to some predefined colors – it’s like doing a voronoi diagram, but in color space, and things remain easy while dealing with only a few colors.

xy-voronoi :
Voronoi of XY

I had already earlier though of what if I extend the voronoi algorithm so it uses the x- and y-coordinates, but considers r-,g- and b-values as well, like a 5-dimensional distance Δx²+Δy²+Δr²+Δg²+Δb² ? Anyway,here’s some – in my opinion – quite interesting results I came up with, xyrgb-voronois with random points and a regular grid:

Voronoi of XYRGB Voronoi XYRGB on a regular grid

Different weights for colors: d²=x²+y²+f(r²+g²+b²) with f= 4.0 and f=-0.25, the last one seems to seach nearby area for a very different color on each pixel, creating like some partial negative:
XY4RGB voronoi XY-0.25RGB voronoi

‘Obamizer’ was written with Pixel Bender, other images with actionscript – I used a very brute-force code. Not like for instance Frank’s voronoi processor, mine is so far more like 1/15 fps !

an article of colour metrics with a more scientific approach.



  1. that last .25 thing stands out for some reason. maybe because trees aren’t black.

  2. The thing about the last one is that it’s a very strange metric (almost Minkowski). Two points far away can still be at distance 0. In fact, an infinite number of points can be at distance 0 from each other. I’m not sure a pixel-based algorithm will give you the true Voronoi diagram, but it’s sure is interesting 😉

  3. really interesting, i think you might want to couple it with some AA of some sorts. I think it could be exploited a bit further.

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: