I'm a bit unsure of what you mean, but the genetic algorithm is used to find an optimal set of points, and then a Delaunay triangulation is created from those points.
Ah, I must've misread the wiki. I thought it meant you used genetic algorithm for triangulation instead of point selection. What's your criteria for calculating the fitness for a candidate set of points?
I was just thinking about adding another wiki page for that, but I'll give a brief explanation here:
Firstly, a triangulation is made from the points and colors are chosen for each triangle.
Then, the variance between the triangles and the original image is calculated using Welford's online algorithm [1]. The variance is computed by iterating over the pixels of each triangle and comparing the pixel color of the original image to the color of that triangle.
Lastly, the fitness is multiplied by a weight to ensure that it covers the entire canvas.
The source code may be a bit confusing because I've applied many optimizations which make it 10-20x faster.
trinovantes|4 years ago
https://github.com/RH12503/Triangula/wiki/Explanation-of-the...
rh12503|4 years ago
Firstly, a triangulation is made from the points and colors are chosen for each triangle.
Then, the variance between the triangles and the original image is calculated using Welford's online algorithm [1]. The variance is computed by iterating over the pixels of each triangle and comparing the pixel color of the original image to the color of that triangle.
Lastly, the fitness is multiplied by a weight to ensure that it covers the entire canvas.
The source code may be a bit confusing because I've applied many optimizations which make it 10-20x faster.
[1] https://en.wikipedia.org/wiki/Algorithms_for_calculating_var...