Archive for the 'color science' Category

Mar 21 2009

Converting Optical Density of a Neutral Target into its RGB code value

Published by under color science

Converting Optical Density of a Neutral Target into its RGB code value


Recently a Color Science  expert who I worked with reviewed this post and here is his comment:

Everything you have is correct.  However, in talking about scanners I think you should make it very clear that you are speaking about the linear response of the scanner.  The work you did on scanners was very much at the core of the true engineering that goes into making a good scanner and dealt with the data before subsequent image processing and color management.

Most people, however are used to seeing the scan data after it goes through gamma correction and image processing (trivial image processing stuff).  Gamma correction is applied “approximately” as such:

CV = 255*T^(1/2.4)

So, your 0.5 transmittance sample will have an 8 bit code value of 191 .  This is further complicated by the fact that my equation above is a simplification of the true 2.2 gamma function (the fact that I use 2.4 instead of 2.2 approximates the effect of an offset term) .  Also, not everyone uses sRGB and there are some 1.8 gamma scanners out there.  Finally, the scanner manufacturer may apply some color management which would further confuse the issue.

Long story short:  Just make it clear that your discussion is on the Linear Response.

====== Original Post Below=======

Well, the headline seems nerdy. Not really if you are into scanner world. This post it very much a knowledge sharing as I could not find anywhere in the net which says how to do the conversion. Not that it is difficult, but takes some understanding and head twitching to do the conversion.

To know what is Optical Density, refer to this wikipedia article . In layman terms, OD is a unit less measurement of  how much light passes through a sample.

Formula to know
OD_lambda = log_{10} O = - log_{10} T = - log_{10} left ({I over I_0} right )

O = the per-unit opacity
T = the per-unit transmittance
I0 = the intensity of the incident light beam
I = the intensity of the transmitted light beam

if you want a sample to have 50% transmittance, then OD of that sample is

OD (50%) =  -log(.50) = 0.3

A neutral target is one that has equal amount of RGB color coded in it. A OD 0.3 neutral target is one whose transmittance is 50%. Now you ask what is the RGB value of the OD 0.3 neutral target. If we consider 8 bit RGB value, then 0 stands for black and 255 stands for white. For 50% transmittance, then the value should be exactly half and it is 128 for R,G & B.

Now let us say you want to prepare a sample that has OD of 0.6. RGB value for OD 0.6 can be obtained as below

-log10(x) = 0.6
x = 10−0.6  ( Should be read as 10 to the power of -0.6 )
X = .25  ( This is 25% transmittance. )
Hence the RGB code will be ( .25 X 256 ) =  64 each ( i.e R=64, G=64,B=64)

Another example, OD of .08

-log10(x) = .08
x = 10−0.08  ( Should be read as 10 to the power of -0.08)
X = .83  ( This is 83% transmittance. )
Hence the RGB code will be ( .83X 256 ) =  212 each ( i.e R=212, G=212,B=212)

Comments Off on Converting Optical Density of a Neutral Target into its RGB code value