Skip to content

miguelgondu/voronoi_me

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

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

Languages