Triangler Save

:triangular_ruler: Convert images to Low-Poly art using Delaunay triangulation.

Project README

Works on my machine

Python Code style: black License: MIT Stargazers Twitter URL

Overview

📐 Convert images to Low-Poly art using Delaunay triangulation.

sample

Table of contents

  1. Installation
  2. Usage
  3. Use as a library
  4. Sample
  5. License

Installation

You need Python 3.10 or higher.

I strongly recommend to use virtual environment such as Anaconda. You can download Anaconda here.

Follow manual below to create python virtual environment for Triangler with the Anaconda.

$ conda create -n triangler python=3.12
$ activate triangler
(triangler)$ python -m pip install git+https://github.com/tdh8316/triangler/

Usage

(triangler)$ python -m triangler -h
usage: __main__.py [-h] [-o OUTPUT] [-p POINTS] [-e {CANNY,ENTROPY,SOBEL}] [-s {POISSON_DISK,THRESHOLD}] [-r {CENTROID,MEAN}] input

positional arguments:
  input                 Input image

options:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        Output image name
  -p POINTS, --points POINTS
                        Number of sample points to use
  -e {CANNY,ENTROPY,SOBEL}, --edge-detector {CANNY,ENTROPY,SOBEL}
                        Edge detection algorithm
  -s {POISSON_DISK,THRESHOLD}, --sampler {POISSON_DISK,THRESHOLD}
                        Point sampling algorithm
  -r {CENTROID,MEAN}, --renderer {CENTROID,MEAN}
                        Color polygon rendering algorithm

API

You can use Triangler as a library.

import triangler

triangler.convert(
    img="INPUT_IMAGE.jpg",
    save_path="OUTPUT_IMAGE.jpg",
)

Sample

Effect of the number of points

Original 5000 Points
sample sample
2500 Points 1000 Points
sample sample

More samples

Original Triangler
sample sample
sample sample
sample sample

License

Licensed under the MIT License.

Copyright 2024 Donghyeok Tak

Credits

Some algorithms, including the Poisson disk sampling, are based on pmaldonado/PyTri.

Open Source Agenda is not affiliated with "Triangler" Project. README Source: tdh8316/triangler
Stars
82
Open Issues
1
Last Commit
2 months ago
Repository
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating