2
$\begingroup$

The target is to get a color of selected area from taken photo on a mobile device. So I've needed to make some image processing programmatically. Is it exist any algorithm to approximate color to it's natural value?

$\endgroup$
1
  • 5
    $\begingroup$ What do you mean by "natural value"? - Color is always dependant on material and lighting. Camera attempt to capture that result. $\endgroup$ Jun 21, 2012 at 16:18

2 Answers 2

7
$\begingroup$

In general case, no, you cannot approximate color of an object from digital image with good accuracy.

Human vision system

What you see is light reflected from the surface of the object. First the object needs to be illuminated with light. This light has some sort of spectrum (probability density function of photon energy). When the light hits the object, the object absorbs some of the light. How much each wavelength of light is absorbed depends on material of the object. Light which is not absorbed, is reflected. Due to the absorption of certain wavelengths, this reflected light has different spectrum than the one which illuminated the object.

You sense the reflected light with four types of light sensitive cells. Each type of cell has its own responsiveness (note the image) for different wavelengths of light. Finally brain combines the data from the light sensitive cells and produces information which you observe as color.

What is color?

So what is the natural value of color? It depends on the reflection and absorption properties of the object, as well as the illumination of the scene, but you probably could describe it as the distribution of observed wavelengths of the light reflected from the object in certain illumination. So if we could reconstruct the wavelength distribution of the observed light, we could describe the natural value of the light color.

How digital cameras capture color?

In digital cameras light sensitive cells are commonly replaced with filter patterns which usually try to capture red, green and blue wavelengths of light. Each filter+light sensitive sensor has certain responsiveness for different wavelengths of light. The responsiveness can vary greatly between different sensor, but they usually try to mimic responsiveness of human vision system (for example see MT9P031 quantum efficiency curves on page 39 of this document).

The RGB image processed by the computer has usually three integer values, red, green and blue. These are weighted integrals of the light spectrum captured by the filtered sensors of the camera.

How to approximate the light spectrum from digital image?

You cannot reconstruct the spectrum from three integrals as there is infinite number of possibilities of light spectrum which would have produced the integrals when weighted with the quantum efficiency of the camera systems.

$\endgroup$
2
  • 3
    $\begingroup$ +1. Just nitpicking: Not every color is a distribution of wavelengths. AFAIK, there's no distribution of wavelengths that looks "brown" if you're in an otherwise dark room - it's always yellow, no matter how dark it is. Only when there's some brighter color you can compare it to does it look "brown". (The same is true for gray, but you could argue that gray is not really a color.) $\endgroup$ Jun 21, 2012 at 19:27
  • $\begingroup$ Probably true, I have to admit that my knowledge about colors is very limited. I have always found color science quite confusing and I still prefer to create gray valued/intensity images simple as averages of red, green and blue channels. It is nice to have feedback from which I can learn. $\endgroup$
    – buq2
    Jun 21, 2012 at 20:18
3
$\begingroup$

The most you can do is to capture a color table with reference colors (e.g. GretagMacbeth) and then calibrate the device (e.g. your camera) using software that generates an ICC profile to it.

This allows you to represent RGB colors from camera sensor in device-independent model (CIE XYZ).

When you have calibrated monitor, you can map colors between devices keeping the colors looking similar.

Of course this can only approximate color constancy between devices through gamut mapping. It will not tell you anything about natural color values.

Furthermore the captured colors always depend on illumination (this applies to calibrated cameras as well).

To measure colors in a physical point of view, you would need a photospectrometer.

The color represented by any model like RGB, XYZ, ABCD... is just a simplification (summations over some wavelength ranges) of intensity histogram in visible color spectrum.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.