Skip to content

pbausch/PYALPIG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A python script to generate low-poly images from a photo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages