Code Monkey home page Code Monkey logo

pyalpig's Introduction

PYALPIG

A python script to generate a low-poly image from a photo.

usage: python triangles.py [image file]

I know nothing about Python. This is my first Python script. It uses scikit-image, matplotlib, and shapely to generate Low Poly art similar to the app PolyGen.

The script extracts points from the picture, creates a Delaunay mesh, finds the center point of every triangle, extracts the color of that pixel, and then fills/plots that triangle with that color. You can optionally use a Voronoi diagram instead.

I put something like this together in JavaScript--YALPIG--and wanted something similar on the command line. I thought Python might work well for it.

To Do:

  • It's fairly slow. PatchCollections help with plotting thousands of polygons, but I wonder if there's a way to parallelize somehow.
  • I'd like to make this interactive like the JavaScript version so I can fiddle with knobs to get different results. I have no idea how to do that.
  • Instead of getting the color of the pixel at the center of the triangle, I'd like to try averaging all pixels within a triangle and using that for the Polygon. Again, no idea how to get the coordinates of every pixel within a triangle.
  • I'd like to be able to find the foreground and background of an image and only create the mesh in one or the other.

pyalpig's People

Contributors

pbausch avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.