Skip to content

rileythomp/voronoi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

voronoi

Computer art and animations created using Voronoi diagrams and Quadtrees.

See here for how to use.

Voronoi diagrams and quadtrees can be used together as a partitioning and colouring algorithm to give images a mosaic look.

Original Mosaic Image Mosaic Gif
parrot parrotg parrotgif
treeimg treesg treegif
chimpimg chimpsg chimpgif
mbimg mbsg mbgif

See Examples.md for more examples.

A Voronoi diagram is an image divided into a given number of regions, where each region is defined by a single point (a "site") and all the points that are closer to that site than any other. Here is an example of adding sites (shown by a black dot) 1 by 1 to an image and giving each region a random colour.

Here's 2 examples of 20 or so sites all moving in random directions.

Here are another two interesting examples.

In the examples above, distance to a site was determined using Euclidean distance, but other methods can be used, such as the Manhattan distance or the Chebyshev distance.

Euclidean Manhattan Chebyshev
euclidean2 manhattan2 chebyshev2
euclidean manhattan chebyshev
chimp chimp3 chimp5
chimp2 chimp4 chimp6
tree tree3 tree5
tree2 tree4 tree6

A quadtree is a tree data structure where each node has 4 children. It is used to represent the image by having each quadrant be the average colour of the image in that region. A metric similar to standard deviation for colour is used split the quadrant with the largest colour error. This has the effect of gradually increasing resolution.

Original Quadtree Image Quadtree Gif
tree qtree qtreeg
chimp qchimp qchimpg
parrots qparrot qparrotg

This algorithm can also be used with other shapes like circles.

Original Circle Image
monalisa monalisacircle
lenna lennacircle

The quadtree data structure can also be used to create other fractal animations

Fractal H Tree T Square
fractal htree tsquare

See QuadImage for more info.

About

Computer art and animations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published