Opal Image Calibration

Extended Exposure

The brightness of opals covers a very wide dynamic range, from very dark areas of bodytone to flash regions that are typically orders of magnitude brighter. This range of brightness exceeds the dynamic range that a standard camera can capture in a single image. To capture the full range of brightness encountered in opals without losing information due to over- or under-exposure, a pair of images is captured at different exposure times. The chosen camera has a 10-bit dynamic range for each red (R), green (G) and blue (B) channel image giving pixels in the range of 0 to 1023. Images Ishort and Ilong are captured at two exposures, tshort and tlong respectively. To allow for the possibility in the future that a camera with significant black levels may be used in the system, the black level image Iblack, is captured when the light is off. Iblack is noisy and so is heavily smoothed. These images are combined to give an image of extended dynamic range, Iext, as shown in Eqn 2.1. This gives a brightness range of 0 to >10,000.

Iext = Ilong
(Ishort – Iblack) * Cscaling+  Iblack
if Ilong < thr
if Ilong >= thr

 2.1

where thr is 900. The exposure.scaling, Cscaling, is determined from images of a standard Kodak White card and is given by the ratio of (mean of (Ilong – Iblack) ) / (mean of (Ishort – Iblack) ). An example is shown in Figure 1.

Figure 1– Comparison of (Left) long exposure image Ilong and (Right) extended exposure image Iext.  (Below Left) Horizontal transect taken through the centre of Ilong showing saturation of the brightest regions of flash (i.e. clipping of the G & R at 1023). (Below Right) Horizontal transect of Iext showing that the extended dynamic range removes the saturation of the flash.

Lighting Correction

With a single light source, the lighting is often not uniform across the field of view of the camera. It will tend to be brighter in the centre of the lighting field. Although we hand select halogen bulbs to have a relatively flat lighting field, there is still considerable lighting variation. For example, a line through the centre of an image of a white card with a centre value of ~700, say, in the green channel would fall off to ~500 at the edges.

We correct for these lighting field variations by imaging uniform white and grey cards manufactured for this purpose for professional photography. We use the Kodak R-27 Grey card set containing a White card of nominal 90% reflectance and a Grey card of nominal 18% reflectance. It is not important if the actual reflectance values of these cards are not exactly as nominated because any gain effects will be compensated for in the following colour calibration step. However, it is important that their reflectance over their entire surface be uniform. Because we are imaging these cards at much closer distances than those used in photography, there can be small scale structure visible in the surface of these cards. It has been found necessary to average these card images at multiple stage rotation angles in order to get repeatable uniformity in their appearance. We use images taken at 20° intervals over the full 360° rotation of the stage. It should be noted that these cards should be replaced if they become discoloured or scratched.

The two averaged lighting field images of the White and Grey cards are referred to as Iwhite and Igrey respectively. Since the CCD sensors in the camera are linear, these lighting field images can be used to correct the extended range image Iext consisting of channels Rext, Gext, and Bext. The lighting corrected image Icor is derived as shown in  Eqn 2.2.

Lmax = max( mean(Rext), mean(Gext), mean(Bext))

 2.2

Icor  = (Iext – Igrey) * Lmax*(90-18)/90 / (Iwhite – Igrey) + Lmax*18/90

where Lmax is the scalar maximum of the means of the channel images.

Colour Calibration

Because the CCD sensors in colour cameras can have different sensitivities and because the spectral characteristics of the light source can vary with time, the lighting corrected image, Icor is specific to our hardware set-up. In other words, it is a device-dependent, relative measure of colour. The process of converting the image to a device-independent, absolute measure of colour is called colour calibration.

Device-specific RGB to device-independent XYZ

In order to convert from device-specific RGB values to device-independent XYZ values as defined by the CIE (Commission Internationale de l’Eclairage, or International Commission on Illumination), we need a calibrated colour checker card such as a Macbeth card which has several colour swatches of known device-independent XYZ values. By capturing an image of this card (as shown in Figure 2) and extracting the mean RGB values for each colour swatch, the transformation matrix, RGB2XYZ, can be determined by linear regression between the measured RGB values and the supplied XYZ values. Thus the RGB values in the Icor image can be converted to XYZ values in the IXYZ image using this matrix.


  

Figure 2 – Image of Macbeth Colour Checker card.

Device-independent XYZ standard

The XYZ values of the swatches of the Macbeth card are for a standard observer (with a 2 degree field of view to use the most colour sensitive part of the eye) and D65 illuminant (designed to match noon daylight which is typical of home and office viewing conditions). They are measured by the National Association of Testing Authorities (NATA) accredited Optics and Radiometry Laboratory at UNSW and placed in the appropriate GDA directory. By using these XYZ values when we calculate the transformation matrix, RGB2XYZ, we can relate the GDA colour measurements to the UNSW laboratory colour standards which are traceable back to the National Physics Laboratory in the UK.

Device-independent XYZ to gamma’d device-independent sRGB

Although the device-independent XYZ measure of colour is an internationally recognised standard for colour representation, it is linear (unlike the human visual system) and not easily understood by non-experts. So we have chosen to convert to a standard RGB representation, called sRGB. The non-linear transfer function (gamma curve) closely matches that of the human visual system. If sRGB images of opals are viewed on sRGB calibrated monitors they will closely match the actual opal appearance if viewed under natural daylight (D65 lighting conditions). So we convert the IXYZ image to the sRGB calibrated image, IsRGB, using the standard transformation matrix, XYZ2sRGB, shown in Eqn 2.3.

XYZ2sRGB =           X         Y         Z R  3.240479 -1.537150 -0.498535 G -0.969256  1.875992  0.041556 B  0.055648 -0.204043  1.057311

 2.3

Gamma’d sRGB to non-linear Look-Up Table’d sRGBlut

The sRGB standard is designed for display of images of diffuse reflecting objects such as the bodytone of the opal. Because the flash is specular reflection from the internal structure of the opal, it can be orders of magnitude brighter. No single image display will be able to accurately represent the colour of both the bodytone and the flash. For this reason, we have used a Look-Up Table (LUT) to compress the dynamic range of the flash so that a realistic view of the bodytone can co-exist with an approximate representation of the flash. This LUT is designed to be linear in the brightness range of the bodytone, 0-Bflash (where Bflash ~500) and to compress flash brightness >Bflash as shown in Figure 3. Applying this LUT to IsRGB gives the image IsRGBlut, as shown in Figure 4. Note that IsRGB shows the true colour of the bright flashes but the bodytone is quite dark. IsRGBlut however gives a realistic representation of bodytone colour but the bright orange flash regions appear more yellow because of saturation. Note that this IsRGBlut image is not for measurement but for display purposes.

 

Figure 3– LUT is a transfer function between input brightness and output brightness.

Figure 4 – Comparison of standardised image IsRGB and LUT-compressed image IsRGBlut.
(Left) IsRGB which shows the true colour of the bright flashes but the bodytone is relatively dark.
(Right) IsRGBlut which gives a true representation of bodytone colour but the bright orange flash
regions appear yellow because of saturation. Horizontal transects through the centre of both
images are shown below.

Colour transformation from sRGB to sHSB

The RGB representation of colour is commonly used in image capture and display devices, but it is not designed for describing human perceptions of colour. For this we transform to an alternative representation of colour called HSB (or HSV). HSB stands for Hue, Saturation and Brightness (also known as Value). Hue is a measure of the wavelength of a colour and is given as an angle between 0 and 360 degrees. Saturation is a measure of the purity of colour or the amount of white added. A pure colour will have 100% saturation. For decreasing values of saturation, the pure colour is increasingly diluted with white. The Brightness (or Value) is a measure of the intensity of the colour. The brightest colour will have 100% brightness. For decreasing values of brightness, the pure colour is increasingly diluted with black. In our extended exposure images, our brightest colour Bmax (100%) has been scaled to 3000.

Because HSB is a simple transformation of the RGB values in an image, it is defined relative to the standards of the RGB values. Transforming sRGB values will give standardised “sHSB” values, relative to the D65 white point. Applying the RGB2HSB transformation (defined in Eqn 2.4) to the IsRGB image, gives the image IsHSB.

H = 0
60º x (gb)/(maxmin) + 0º
60º x (gb)/(maxmin) + 360º
60º x (br)/(maxmin) + 120º
60º x (rg)/(maxmin) + 240º
if max = min
if max = r & g >= b
if max = r & g < b
if max = g
if max = b

 2.4

S = 0
1 – min/ max
if max = 0
otherwise
B = max*Bmax

where r, g, b are the R, G, and B values, respectively, of a pixel scaled to the range from 0 – 1;
max is the maximum of r, g, and b, and min is the minimum

click here to see dimension calibration