poly

module
v0.0.0-...-9029c63 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2023 License: MIT

README

Poly

Go CLI application to optimize the shape of a fixed number of polygons to minimize the difference to a target image using a genetic algorithm just for fun.

Project highly inspired in the work of Michael Fogleman and Roger Johansson but using a different approach and getting different results.

Target image

Target

Resulting image

Result Image generated with 200 polygons and 80000 iterations.

Features

  • Select the number of polygons used to reproduce the target image.
  • Select the number of generations for the algorithm to iterate.

Installation

Install with:

go get -u https://github.com/dmartzol/poly.git

Usage and examples

Options
Usage: polygonal [OPTIONS] -o output
  -i string
    	input image path
  -n int
    	number of iterations (default 1000)
  -o value
    	output image path
  -p int
    	number of polygons (default 50)
  -r int
    	resize large input images to this size (default 256)

To generate an image with 200 polygons and 50k iterations input:

poly -i input.png -o output.svg -n 50000 -p 200

TO DO

  • Concurrency
  • Implement save a frame every N iterations.
  • Add more examples.
  • Improve this README.

License

This project is licensed under the MIT License

Examples

Target

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL