1. A computer-implemented method of removing illumination variation from images comprising: selecting, by a computer system, an image containing varying illumination, wherein the varying illumination comprises a shadow in the image; determining, by the computer system, a plurality of instances of a pattern of pixel values in the image; calculating, by the computer system, illumination values for pixels at locations within the plurality of instances of the pattern, an illumination value for a pixel within an instance of the pattern calculated based on a difference between a pixel intensity of the pixel within the instance of the pattern and a pixel intensity of another pixel at a corresponding location in an adjacent instance of the pattern; and removing, by the computer system, the illumination variation from the image responsive to the calculation of the illumination values.