Crack up opening, cool concept. Would make for a good Jackbox game. How does the picture grading work?
Viewing post in Port-Faux-lio jam comments
The grading was the real head scratcher in the code! I first downscale both images to 16x16 pixels for averaging and performance, then compare them with the following method:
1) I define a 'distance' between two colors that is coherent with human perception: the more two colors are 'different', the higher the distance between them.
2) I calculate the L2 distance between the two down-scaled images: that is the sum of the squares of these distances for every 16x16 pixel (and then take the square root of the whole thing I believe)
3) To allow for more variations, I also compare the color histogram of both images, that is the proportion of appearance of each color globally on the picture (not necessarily in the right place). The final distance is a mix of the L2 distance and this histogram distance.
4) Finally I played around with bunch of coefficients to turn this distance into a percentage of accuracy, not too rigid to make the game fair.