/triangler

Convert images to Low-Poly art using Delaunay triangulation.

Primary LanguagePythonMIT LicenseMIT

Overview

Triangler is a tool to generate Low-Polygon image using Delaunay triangulation.

sample

Usage

Currently, the interface for end-users is only Command-Line.

$ git clone https://github.com/tdh8316/triangler.git
$ python -m pip install -r requirements.txt
$ python triangler-cli.py

Install

$ git clone https://github.com/tdh8316/triangler.git
$ python -m pip install setup.py
$ python -m triangler -h
usage: __main__.py [-h] [-o O] [-s {POISSON_DISK,THRESHOLD}]
                   [-e {CANNY,ENTROPY,SOBEL}] [-c {MEAN,CENTROID}] [-p POINTS]
                   image

positional arguments:
  image                 Source file

optional arguments:
  -h, --help            show this help message and exit
  -o O                  Destination file (default: None)
  -s {POISSON_DISK,THRESHOLD}, --sample {POISSON_DISK,THRESHOLD}
                        Sampling method for candidate points. 
                        (default:threshold)
  -e {CANNY,ENTROPY,SOBEL}, --edge {CANNY,ENTROPY,SOBEL}
                        Pre-processing method to use. (default: sobel)
  -c {MEAN,CENTROID}, --color {MEAN,CENTROID}
                        Coloring method for rendering. (default: centroid)
  -p POINTS, --points POINTS
                        Points threshold. (default: 4096)

The POISSON_DISK option is extremely slow, however it can provide the best result.

It takes a minimum of 5 seconds to a maximum of 3 minutes.

Example command

$ python -m triangler image.jpg -o output.jpg -p=1000

Sample

Original 5000 Points
sample sample
2500 Points 1000 Points
sample sample
Original Processed
sample sample
sample sample
sample sample
sample sample

Acknowledgement

The Canny Edge Detection and Sampling algorithms are based on pmaldonado/PyTri

TODO

  • Sobel