Skip to content

A Python script for modifying images using Voronoi tessellations

Notifications You must be signed in to change notification settings

miguelgondu/voronoi_me

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Voronoi me

A Python script that takes an image and outputs a pixelated version using Voronoi tessellations.

The script loads the image, places n_points random points in the image and uses them as the seeds in a Voronoi tessellation. Then, region of the tessellation gets covered by the average color in it.

Right now the script is somewhat slow, because I went with the overkill of computing the shortest distance of each pixel to the seeds using a KDTree.

Usage

I assume you are running Python 3. You can create a new environment and install the requirements using

pip install -r requirements.txt

Then, you can run:

python process.py path_to_image.jpg

After running this script, the generated image will be saved as out.jpg in your working directory.

You can also specify two parameters: out (the path and name of the resulting image) and n_points (the amount of random points that are used as seeds in the tessellation). For example

python process.py example.jpg --out="example_50.jpg" --n_points=50

Example

Image before processing

Image after processing

About

A Python script for modifying images using Voronoi tessellations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages