Don said:
Does anybody happen to know the formula used to calculate the value of
a pixel once a certain amount of Analog Gain (AG) is applied?
Example: Scan at Master AG=0. The value of a pixel is R=100, G=100,
B=100. What would be value of that pixel when at, say, Master AG=1?
I assume the same formula would apply to individual RGB channels,
right?
I have a sensation of deja-vu on this question, but my ISP's news server
has been playing up recently (failing completely for the past few days)
and some messages seem to have been lost, so if I have answered it
before, the response might not have got through.
EV = Exposure Value. This is based on the photographic system where the
exposure to the film could be adjusted by changing the time the shutter
was open for or by changing the lens aperture. Increasing the lens f/#
by one stop and decreasing the shutter speed by one stop resulted in the
same amount of light reaching the film and hence the same exposure
value. This was standardised based on an EV rating of 0 for 1 second
exposure on film with a lens aperture of f/1, with each integer
increment of EV resulting in half the exposure of the previous value.
Lens f/# is approximately proportional to the aperture diameter (an
approximation which becomes increasingly inaccurate as f/# decreases
below 1) and so the area of the aperture is proportional to the square
of f/#, to the same level of approximation. Hence a lens of f/1.4 has
an aperture with half the area of an f/1 lens and consequently it
transmits half as much light. Thus 1sec exposure at f/1.4 corresponds
to EV=1, as does an f/1 lens with an exposure of 0.5sec. An f/2 lens
with 1sec exposure has EV=2, as does an f/1.4 lens with 0.5sec, and an
f/1 lens with 0.25sec and so on.
A typical fast photo lens might be f/1.4, giving an EV of 1 at the
longest typical timed exposure of 1 second. F/22 and 1/4000sec,
probably the shortest exposure available on typical good 35mm cameras,
corresponds to EV=21 (log-base2(4000)+log-base-sqrt2(22) = 12 + 9 = 21).
So the total exposure adjustment range of most 35mm cameras is around
20EV, corresponding to about a scale of 1 million to one!
There are lots of charts available to compute EV from f/# and shutter
speed on the Internet - Google on Exposure Value.
In NikonScan, the Analog Gain sliders are measured in EV and, apart from
the fact that the numbers are reversed from the standard EV definition,
operates on the same principle. Thus EV=1 in AG gives twice the
exposure to the CCD that it achieves in EV=0. EV=2, gives 4x the
exposure, EV=-1 gives 0.5x and EV=-2 gives 0.25x the exposure at the
CCD. Hence a pixel which has a value of 50 at EV=0 will have 100@EV=1 &
200@EV=2 or 25@EV-1 & 12 or 13@EV=-2. With the master analogue gain and
the three individual colours all set to EV=2, the total exposure on the
CCD, and hence the pixel value, is increased by a factor of 16x the
normal default levels.
The resulting pixel amplitude at any EV will be:
P(EV) = P(0).2^EV
where P(0) is the pixel value at EV=0
P(EV) is the value at the EV required
EV is the Exposure Value.
A more general formula is that the pixel value at a new EV will be given
by P(New) = P(Old).2^(New-Old)
where New is the new EV and Old is the original EV at which you know the
pixel value (within the limits of the quantisation accuracy of the
scanner's ADC).
However, the CCD is a very linear device and the above only corresponds
to the data output by it and subsequently digitised - ie. raw data.
Normally the data that you are looking at has undergone some overall
gamma correction to match the display characteristics, or even more
detailed colour management. So this must be taken account of when
considering the effect of analogue gain on any pixel value. The
consequence is that for highlights the EV adjustement is significantly
reduced from that expected whilst for shadows it is greater than
expected. For general gamma adjustment, the exact effect is fairly easy
to calculate using the natural logs and exponentials of the gamma used
to estimate, first, from the pixel data what the original CCD output
value was and then, from the output of the above formulae, what the
resulting pixel data of the new CCD output value will be. For a colour
managed system you need to access the detailed colour lookup tables used
in the management systems - which can become complex, especially if
colour space conversions are performed.
The easiest way of seeing the effect of the analogue gain on the actual
data itself is to conduct scans with NCM off and gamma set to unity.
This will result in very dark images, of course, but you will see the
exact effect of the analogue gain. Scan first at AG=0 and examine the
histogram of a relatively uniform crop. Note the median value of the
histogram (viewed in Photoshop without any colour management). Compare
this to the medians of scans at other EV's and you should see them
conform to the above rules, within the accuracy of the ADC in your
scanner.