Posts

Showing posts from October, 2017

Evolving an image, part II - image rendering

The second installment in the series on evolving an image with trianges. In this post I will focus on the rendering of the actual image, both for rendering and scoring. Other parts of this series are: Make a generator for the genome. Translate genome to a rendered image. Score the rendered image and compare for evolution. (Optional) Possible optimizations. Scoring generations is done by comparing their matrix representations. At the start of the project I started pretty much blank on the rendering of polygons in python. The Pillow package is primarily meant for graphical implementations, not matrix algebra. My path of drawing polygons on a canvas and then turning the canvas into a matrix representation could just as easily have been reversed. When everything was implemented, the performance wasn't optimal and I looked into mathematical generation of polygons with the shapely module. For now, let's focus on drawing polygons on the canvas. python; genomeGenerator.py

Evolving an image, part I - genome generation

Image
This will be the first post in a series on a simple evolutionary algorithm. The inspiration comes from several blog posts, but primarily from Roger Johansson and Chris Cummins . I haven't really dug through this code, but just started replicating what they wrote and the images they generated. Credits to Pierre Lindenbaum for this image. The plan right now is separated in this rough outline. This is the first instalment, with a focus on generating the data structures that represent a generated image. Make a generator for the genome. Translate genome to a rendered image. Score the rendered image and compare for evolution. (Optional) Possible optimizations. For starters, let's generate random polygons. They have a shape, and a colour. I've decided for now on sticking to just one kind of polygon, the triangle. Perhaps in a later version there could be polygons with more edges, but I'm curious how good generated images could turn out with just triangles. A