A system that compensates for uneven lighting in a digital image of a
surface. During operation, the system receives the digital image of the
surface. Next, the system obtains a reference lighting map for the
surface, which contains information about the lighting of the surface at
the time the digital image was acquired. The system then uses the
reference lighting map to compensate for uneven lighting in the digital
image.