GithubHelp home page GithubHelp logo

poly's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.