Patent attributes
An electronic device may have a camera that captures images of objects that are illuminated by ambient light. Some ambient light sources may not render the colors of objects faithfully. To detect low quality ambient lighting conditions and to correct for these conditions, control circuitry in the electronic device gathers ambient light measurements from a color ambient light sensor. The measurements are used to produce an ambient light spectral power distribution. The ambient light spectral power distribution can be applied to a series of test color samples to produce responses. Responses can also be produced by applying a reference illuminant to the test color samples. These responses can then be processed to generate a color rendering index or other color rendering metric for the ambient light and can be used to create a color correction matrix to correct the color of the captured images.