Once the computer has the triplet (r, g, b) of a square, an algorithm calculates which Smartie/M&M’s colour that square is closest to, and replaces the square by a chocolate of that colour. The method used imagines (r, g, b) as 3D coordinates. Each Smarties/M&M’s colour is also a fixed triplet of 3D coordinates. The nearest colour is the one of closest distance in 3D space, which is calculated using Pythagoras’s Theorem. Here is Marilyn in a row of only 20 Smarties. If you squint your eyes, or hold the image at a distance you can still see her face pretty clearly.
Read More