Color constancy is an example of subjective constancy and a feature of the human color perception system which ensures that the perceived color of objects remains relatively constant under varying illumination conditions. A green apple for instance looks green to us at midday, when the main illumination is white sunlight, and also at sunset, when the main illumination is red. This helps us identify objects.
Color vision is a process by which organisms and machines are able to distinguish objects based on the different wavelengths of light reflected, transmitted, or emitted by the object. In humans, light is detected by the eye using two types of photoreceptors, cones and rods, which send signals to the visual cortex, which in turn processes those sensations into a subjective perception of color. Color constancy is a process that allows the brain to recognize a familiar object as being a consistent color regardless of the amount or wavelengths of light reflecting from it at a given moment.
The physiological basis for color constancy is thought to involve specialized neurons in the primary visual cortex that compute local ratios of cone activity, which is the same calculation that Land's retinex algorithm uses to achieve color constancy. These specialized cells are called double-opponent cells because they compute both color opponency and spatial opponency. Double-opponent cells were first described by Nigel Daw in the goldfish retina. There was considerable debate about the existence of these cells in the primate visual system; their existence was eventually proven using reverse-correlation receptive field mapping and special stimuli that selectively activate single cone classes at a time, so-called "cone-isolating" stimuli.
Color constancy works only if the incident illumination contains a range of wavelengths. The different cone cells of the eye register different but overlapping ranges of wavelengths of the light reflected by every object in the scene. From this information, the visual system attempts to determine the approximate composition of the illuminating light. This illumination is then discounted in order to obtain the object's "true color" or reflectance: the wavelengths of light the object reflects. This reflectance then largely determines the perceived color.