Images as Voronoi tesselations

This is probably the coolest-looking thing I’ve figured out how to do with raster images in R. Similar to (although not quite as impressive as) these images by Jeff Clark, I alter the simple k-means approach described in the previous post to cluster primarily in Cartesian space, rather than in color space. This produces, essentially, Voronoi regions shaded with a region-average color, and the effect is really neat.

Note that increasing nRegions can produce drastically different results, but that kmeans() is quite slow as nRegions increases. Below, you’ll find a few examples, as well as the code. If you use this to make anything impressive, share it with us at @isDotR.

By d-sparks

Tags: rstats ReadImages reshape ggplot2