Linearisation of RGB Camera Responses For Quantitative Image Analysis of Visible and UV Photography: A Comparison of Two Techniques
Linearisation of RGB Camera Responses For Quantitative Image Analysis of Visible and UV Photography: A Comparison of Two Techniques
     Abstract
     Linear camera responses are required for recovering the total amount of incident irradiance, quantitative image analysis,
     spectral reconstruction from camera responses and characterisation of spectral sensitivity curves. Two commercially-
     available digital cameras equipped with Bayer filter arrays and sensitive to visible and near-UV radiation were characterised
     using biexponential and Bézier curves. Both methods successfully fitted the entire characteristic curve of the tested devices,
     allowing for an accurate recovery of linear camera responses, particularly those corresponding to the middle of the
     exposure range. Nevertheless the two methods differ in the nature of the required input parameters and the uncertainty
     associated with the recovered linear camera responses obtained at the extreme ends of the exposure range. Here we
     demonstrate the use of both methods for retrieving information about scene irradiance, describing and quantifying the
     uncertainty involved in the estimation of linear camera responses.
  Citation: Garcia JE, Dyer AG, Greentree AD, Spring G, Wilksch PA (2013) Linearisation of RGB Camera Responses for Quantitative Image Analysis of Visible and UV
  Photography: A Comparison of Two Techniques. PLoS ONE 8(11): e79534. doi:10.1371/journal.pone.0079534
  Editor: Christof Markus Aegerter, University of Zurich, Switzerland
  Received August 1, 2013; Accepted September 30, 2013; Published November 18, 2013
  Copyright: ß 2013 Garcia et al. This is an open-access article distributed under the terms of the Creative Commons Attribution License, which permits
  unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
  Funding: Jair E. Garcia was partially supported by Colfuturo 200818772 (Colombia). A.G.D. was supported by Australian Research Council DP0878968/
  DP0987989. A.D.G. acknowledges the Australian Research Council for financial support (Project No DP0880466). The funders had no role in study design, data
  collection and analysis, decision to publish, or preparation of the manuscript.
  Competing Interests: The authors declare that one of the authors, Adrian G. Dyer, is a PLOS ONE Editorial Board member. This does not alter their adherence to
  all the PLOS ONE policies on sharing data and materials.
  * E-mail: jirgarci@gmail.com
    Here we compare the use of (parametric) cubic Bézier curves            Materials and Methods
and biexponential functions for characterising two camera models:
(i) a Canon D40 camera sensitive to visible radiation and (ii) a            Definitions
Nikon D70s camera modified for recording near-ultraviolet                      In an ideal system, the camera response at each pixel site of a
radiation. Although both methodologies allow the recovery of                CCD or CMOS sensor is defined by the total number of
linear camera responses, they differ in the model assumptions, the          photoelectrons generated by input radiance and the combined
interpretation of the recovered camera responses and the size of            effect of the analogue to digital conversion, signal amplifiers and
the uncertainty bounds associated with the recovered responses.             software balancing in the system. The response per pixel is [18]:
We compare performance using both methods and provide some
recommendations for selecting the appropriate method depending                                         r        gpe
on the intended use of the recovered linear responses.                                                     ~G(      ),                         ð1Þ
                                                                                                      rmax     gmax
Figure 1. Cubic Bézier curves (dashed lines) and biexponential functions (solid lines) fitting the camera responses (circle markers)
making up the OECF curves for the red (a), green (b) and blue (c) colour channels of a Canon 40D digital camera and the red colour
channel of a Nikon D70s camera modified for ultraviolet recording (d). Exposure values corresponding to the total incident irradiance were
calculated from Equation (2). Values were normalised by dividing the total amount of irradiance required for each camera response (g) by the amount
of energy required to attain a camera response equal to the selected maximum pixel response rmax (gmax ). See text for details.
doi:10.1371/journal.pone.0079534.g001
where G is the OECF, which expresses the digital output r of a                         the replacement of the standard hot mirror filter by a Baader U
pixel as a function of gpe , the number of generated photoelectrons.                   filter (Company Seven, USA), cutting off radiation at wavelengths
The function is normalised such that the output reaches its                            longer than 398 nm, and adjusting the focusing point. The Canon
maximum value of rmax when gpe ~gmax . In the simplest case,                           camera was equipped with a 100 mm Electro-Focus (EF) lens
gmax is the maximum number of photoelectrons that can be stored                        (Canon Inc., Japan) fitted with a skylight filter (Hoya, Philippines).
in the electron well of the photoelement and rmax is the maximum                       The modified Nikon D70s camera was equipped with a Micro
output determined by the bit-depth of the converter. However, we                       Nikkor 105 mm quartz lens (Nikon Corporation, Japan) to ensure
found it to be an advantage to define these two constants to be                        a free transmission of near-ultraviolet radiation [24,25].
smaller than each of these two limits, about 250 intensity levels and
their corresponding exposure values as detailed in the Results                         Reconstruction of the OECF Curves
section, to avoid anomalous behaviour close to saturation of the                           We reconstructed OECF curves corresponding to the different
electron well i.e. clipping [2]. In any case we define G such that                     colour channels of each test camera by plotting the camera
r = rmax when gpe = gmax ; i.e., G(1)~1.                                               response (r), in pixel intensity values, against signals of varying
   The number of photoelectrons generated at each pixel site                           intensity calculated from Equation (2), following a protocol similar
depends on the scene radiance, the characteristics of the lens, the                    to the one specified by the ISO 14524:2009 standard [26]. Most
selected exposure parameters, the transmissive properties of the                       photographic lenses have a uniform spectral transmittance within
optics and the spectral sensitivity of the material making up the                      the 400{710 nm spectral interval [25]; therefore, TOp (l) in
sensor [18]:                                                                           Equation (2) was treated as a constant for the calculations. The
                                                                                       same property characterises quartz optics in the 300{400 nm
                       ðl                                                              spectral interval [24,25] so the same procedure was implemented
                            b   p : Lq (l)AD :                                         for the calculations corresponding to the UV-sensitive channel of
               gpe ~                           Rq (l):TOp (l)tdl,           ð2Þ
                           la   4 f 2 (1zM)                                            the Nikon camera. The irradiation source was a xenon arc lamp
                                                                                       type VX150-1f-2b-L (Siemens, Germany) continuously emitting
where Lq (l) is the spectral radiance incident on the camera lens,                     radiation between 300{800 nm.
AD the effective detector area, f is the lens f -number, M is the                          The radiance of each signal was measured with an NIST
optical magnification, Rq (l) is the spectral sensitivity, TOp (l) is the              traceable ILT-900 spectroradiometer (International Light Tech-
combined spectral transmittance of the lens and any hardware                           nologies, USA) equipped with a narrow acceptance-angle collector
filters (colour filters, polariser, hot mirror filter, etc.) and t is the              (International Light Technologies, USA). Each radiance reading
integration time, set by the shutter speed [18]. The wavelength                        was the average of five different scans between 250 and 950 nm at
integration is carried out over the range for which Rq (l) is non-                     1 nm intervals. Raw spectral radiance data were expressed as a
zero.                                                                                  photon flux (mmol:m{2 :s{1 :nm{1 :sr{1 ). Converted data were
                                                                                       subsequently binned at 5 nm intervals. Data corresponding to the
Camera Systems                                                                         395{710 nm interval were used for the characterisation of the
   OECF curves were reconstructed for the three colour channels                        Canon camera, whilst 300{400 nm spectral data were used for
of a Canon 40D (Canon Inc, Japan) and the ‘red’ colour channel                         characterising the Nikon camera.
of a Nikon D70s (Nikon Corporation, Japan) modified for reflected                          Signals required to reconstruct the OECF curves of the Canon
ultraviolet image recording. By selecting these two cameras we                         camera were obtained by employing a set of four neutral density
ensured that the proposed methodology is applicable to different                       filters (Newport, USA) with nominal values of optical density (OD)
consumer-level cameras equipped with Bayer filter arrays inde-                         of 0.1, 0.2, 0.5 and 1.0. Additional densities of OD 0.3, 0.7, 1.2
pendently from their spectral sensitivity range. The ‘red’ channel                     and 1.5 were obtained by combining the filters. Filters were
of the Nikon D70s camera was selected as this shows the highest                        mounted on a holder located at 0.12 m from the xenon arc lamp.
sensitivity to near-ultraviolet radiation [23]. Camera modification                    The lamp output was projected through a baffle onto a glass
for ultraviolet recording was carried out by a professional camera                     diffuser screen (Edmund Optics, USA) placed on a filter holder
technician (Camera Clinic, Melbourne, Australia) and included                          positioned 0.46 m from the xenon lamp.
Table 1. Coefficients of biexponential functions fitting the OECF curves for two camera models.
Channel Channel
 Mean coefficients (m) and 95% confidence intervals (CI) of biexponential curves fitting the three colour channels of a Canon 40D camera and the red channel of a Nikon
 D70s modified for reflected ultraviolet recording, rlim = 255 in all cases.
 doi:10.1371/journal.pone.0079534.t001
 Table 2. Coordinates and 95% confidence intervals for the four control points defining each Bézier curve fitting the OECF curves
 for two camera models.
Channel Parameter P0 P1 P2 P3
 Mean coordinates (m) and 95% confidence intervals (CI) for the four control points defining cubic Bézier curves fitting the OECF curves reconstructed for the colour
 channels of a Canon 40D camera and the ‘red’-UV channel of a modified Nikon D70s. Coordinates of the first and last control points correspond to the normalised
 minimum and maximum camera responses included in the OECF and the normalised exposure required to obtain them. Exposure values (g) are expressed in m mol units
 and camera responses (r) in normalised pixel intensity levels.
 doi:10.1371/journal.pone.0079534.t002
   A different approach was required for reconstructing the OECF                     IEC61966-2.1 colour space (Nikon camera). Raw image process-
curves for the modified Nikon D70s camera. Because of the low                        ing was performed employing the Camera Raw Plug-in v.6.7 for
near-UV irradiation transmittance of the neutral density filters and                 Photoshop CS5 (Adobe Incorporated, USA). Processed images
diffuser screen, the irradiation produced by the xenon arc lamp                      were subsequently encoded into uncompressed 8-bit TIFF files.
was projected onto five diffuse achromatic targets, each one                         Camera responses were calculated from the average pixel intensity
reflecting different amounts of incident irradiation, to obtain                      in a 50 times 50 pixel sample area located at the centre of each
signals of varying intensity. The achromatic targets were                            image. Sampling was performed on the TIFF files employing the
constructed by mixing barium sulphate with different proportions                     ImageJ processing software version 1.42q (National Institutes of
of activated charcoal following published protocols [27] yielding                    Health, USA) [28].
reflectance values of approximately 86, 60, 51, 15 and 2% for
incident near-UV irradiation, thus covering a wide range of                          Biexponential, Cubic Bézier Curve Fitting and
camera responses up to the saturation point. Spectral radiance                       Linearisation
readings were obtained after placing each calibration target
                                                                                        Biexponential and cubic Bézier curves were fitted to the OECF
0.25 m away from the xenon arc lamp and irradiating the targets
                                                                                     curves reconstructed for the two tested cameras. A biexponential
at normal incidence. The narrow-angle acceptance collector of the
                                                                                     function was selected as it provides a good model for the apparent
spectroradiometer was placed at 0.07 m from each one of the
                                                                                     dual-region instrument response function of many consumer-level
targets and oriented 45o from the target normal.
                                                                                     digital cameras, namely the observed high sensitivity to low light
   Camera responses for each signal were obtained by taking a
                                                                                     levels and the saturation response at high light levels, as suggested
series of images of either the diffuser screen or the achromatic
                                                                                     by the use of non-linear expressions including several exponentials
reflective target, from the same direction as the spectroradiometer
                                                                                     to model the gain function of these cameras [22]. The observed
measurements. Ten f-apertures were selected for testing the Canon
                                                                                     compression of camera response at high radiance levels is used to
40D camera including complete, half and third stops from f-
                                                                                     extend dynamic range [29]. The Bézier functions produce flexible
aperture 8 to 22. For the modified Nikon camera seven f-apertures
                                                                                     curves for fitting different data distributions [30], are intuitive, and
were selected representing complete stops from f-aperture 32 to
                                                                                     easily inverted with LUTs as as shown in the Results section;
4.0 and including f-aperture 4.5. Shutter speed (integration time)
                                                                                     however, these functions do not have such a close physical
was fixed in both cameras at 0.017 seconds for the Canon camera
                                                                                     connection with the voltage response from the camera sensor.
and 2 seconds for the Nikon camera. ISO 200 was selected in both
devices. White balance programs were set at 5100 K for the                              A cubic Bézier curve is defined by the position of four control
Canon camera and the pre-set ‘flash’ program (approximately                          points (P0 , . . . ,P3 ) and it is constructed by evaluating an
5400 K) for the Nikon camera. A dark image, with the lens cap                        independent parameter t in a ½0,1 interval. If Equation (1) is
on, was recorded at the beginning of each image-recording run to                     rewritten as y~G(x), then the Bézier curve is described
account for dark noise. The dark image was subsequently                              parametrically by Equation 3.
subtracted from each camera response image at each pixel
location over the entire image. Images were recorded in the native                            gpe
                                                                                        x~        ~(1{t)3 P0x z3(1{t)2 tP1x z3(1{t)t2 P2x zt3 P3x ,
RAW file format for each camera and encoded either into the                                  gmax
Adobe 1998 colour space (Canon camera), or the sRGB
G(1)~1 [rlim ~rmax zb: exp ({cgmax )zd : exp ({ggmax ):ð5Þ
Figure 3. Recovered linear camera responses and confidence bounds for the (A–B) red, (C–D) green and (E–F) blue channels of a
Canon 40D digital camera and; (G–H) the red channel of a Nikon D70s camera modified for ultraviolet recording, using cubic Bézier
curves (left column) and biexponential functions{ (right column). Linear camera responses were obtained by inverting the biexponential
fitting function (Equation 4) (squares) and implementing a look up table derived after evaluating a cubic Bézier curve (Equation 3)(circles). Confidence
bounds represent the standard deviation in all cases. { Standard deviation of the biexponential function |5 for display purposes.
doi:10.1371/journal.pone.0079534.g003
Figure 4. Standard deviation of linear camera responses (cross markers) as a function of increasing values of g/gmax recovered
implementing a biexponential function (dotted line left column) and cubic Bézier curves (solid and dashed lines right column) for
the (A–B) red, (C–D) green and (E–F) blue channels of a Canon 40D digital camera and; (G–H) the red channel of a Nikon D70s
camera modified for ultraviolet recording. Standard deviations for each g/gmax recovered by the biexponential function were obtained after
simulating 1,000 normally-distributed random coefficients within the 95% confidence intervals for each of the four parameters in Table 1. Standard
deviation for each g/gmax recovered by the cubic Bézier curve were obtained from the LUTs constructed after simulating 1,000 normally-distributed
pseudorandom coefficients within the 95% confidence intervals for the eight parameters in Table 2. Solid line in panels B, D, F and H corresponds to
the standard deviation of the normalised camera responses (r), whilst the dashed line represents the standard deviation of the recovered normalised
exposure value (g).
doi:10.1371/journal.pone.0079534.g004
following the same procedure implemented for the biexponential               OECF curve: camera responses and irradiation input, with the
method.                                                                      latter defined by the selected exposure parameters as expressed by
                                                                             Equation 2.
Results                                                                         Pixel intensity values, representing the camera output, were
                                                                             normalised by dividing each camera response by the maximum
    OECF curves were reconstructed for the three different colour            intensity level attainable in the selected colour-bit depth scale. This
channels of the Canon camera and the red channel of the modified             value, rmax , equals 255 intensity levels for the 8-bit colour
Nikon device. All the reconstructed OECF curves present a similar            encoding scheme selected for characterising the two cameras.
form that are entirely fitted by implementing either biexponential           Normalisation of the input exposure was done by dividing the
functions or cubic Bézier curves (Figure 1); nevertheless, the use of       exposure value g corresponding to each camera response included
Bézier curves requires an additional normalisation step prior to            in the OECF by the exposure required to obtain rmax for each
fitting as these curves are solely defined in a [0, 1] interval [30].        characterised colour channel.
Normalisation was carried out on the two variables defining the
 Table 3. Statistical comparison of the linear camera respons-                             Linear camera responses recovered by implementing the two
 es obtained with two characterisation methods.                                         methods are presented in Figure 3. The uncertainty associated
                                                                                        with the recovery of the linear camera responses varies with the
                                                                                        exposure, reaching its maximum value at rmax for the two
                SSE (mmol)                        Wilcoxon signed rank test             methods. Such a behaviour is not surprising, as large changes in
 Channel
                                                                                        exposure only produce slight changes in camera responses near
                                    Cubic                       Significance
                                                                                        rmax as expected from the asymptotic behaviour of the OECF
                Biexponential       Bézier       Statistic     (2-tailed)
                                                                                        curve (Figure 1); however, an important difference between the
 Red Canon      4.2161024           2.0261023     4580          0.751                   two methods is the number of dimensions associated with the
                          24
 Green Canon    4.35610             1.7561023     4450          0.761                   uncertainty of the recovered linear camera responses. Whilst the
 Blue Canon     1.1261023           2.6161023     4720          0.764                   uncertainty of the linear camera responses recovered by imple-
 Red Nikon      1.0961023           3.4061024     326           0.825
                                                                                        menting a biexponential function is only associated with the
                                                                                        recovered exposure value, i.e. variation in the y-axis (Figure 3,
 Sum of squared errors for the values predicted by the functions fitting the OECF       right column), the uncertainty of the recovered linear camera
 curves (second and third column) and results of the statistical comparison             responses by using Bézier involves both the g=gmax and r=rmax
 between the camera responses predicted by the two methods.
                                                                                        parameters (Figure 3, left column), as these are required to define
 doi:10.1371/journal.pone.0079534.t003
                                                                                        each Pn control point of the Bézier curve (Equation 3).
                                                                                           The magnitude of the uncertainty associated with the recovered
                                                                                        linear camera responses is not uniform, but varies with the
    The maximum exposure values (gmax ) obtained for the four                           different values of g irrespective of the employed linearisation
characterised colour channels were: 0.0122 mmol, 0.0125 mmol,                           method (Figure 4). However, differences do exist in the total
0.0124 mmol and 0.0081 mmol, corresponding to the Canon                                 magnitude of the standard deviation obtained by implementing
camera red, green, blue channels and the modified Nikon D70s                            each method and in the precise g values where it is higher. In the
UV-sensitive red channel respectively. gmax values were obtained                        case of the biexponential function, the magnitude of the standard
from a biexponential function fitted to the OECF curves expressed                       deviation increases in a relatively linear manner after reaching
in the original (not normalised) scale; however, these values can                       about 10% of gmax and up to the saturation region where it rapidly
also be directly obtained from the OECF curve either by visual                          increases until reaching gmax (Figure 4, left column). This
inspection or by linear interpolation of the OECF data points,                          behaviour is also observed for the Bézier curves with an additional
provided that there are enough points at the upper end of the                           increase in the uncertainty of the recovered g values at low
curve up to the rmax value. Note that a biexponential function can                      irradiance levels arising from the high standard deviation
be fitted to the OECF curve expressed either in the original or a                       associated with the r=rmax parameter (Figure 4, right column).
normalised scale.                                                                          The sum of squared errors (SSE) between the measured
    Regardless of the method selected to fit a given OECF curve,                        irradiance input (exposure) and the linear camera responses
linear camera responses, i.e. the intensity of the irradiance signal at                 recovered by the two fitting functions is presented in the second
a given pixel location corresponding to a given r value, can be                         and third columns of Table 3. Even though the implementation of
recovered by inverting the equation of the selected fitting function.                   biexponential functions always resulted in predicted camera
The parameters defining the two fitting functions, namely the                           response values which are closer to the exposure calculated from
coefficients of the biexponential function and the coordinates of                       the measured irradiance, particularly at the extreme ends of the
the control points for the Bézier curve, are presented in Tables 1                     exposure range, a comparison of the median differences between
and 2 along with their 95% confidence intervals. Equations 1 and                        the camera response values predicted by the two methods for the
2 present the general form of the two fitting functions. Whilst the                     entire exposure interval did not prove significantly different
biexponential function coefficients and associated 95% confidence                       (Table 3 fourth and fifth column). However, significant differences
intervals (Table 1) were obtained directly from the output of the                       between the two methods do exist in the computational time
biexponential fitting procedure, implementation of simulation                           required for applying the two methods. Calculation of the
techniques were necessary for obtaining the coordinates of the                          confidence bounds for 256 linear responses, as required to
control point defining the Bézier and their 95% confidence                             reconstruct the LUT employed for linearising images, took a
intervals (Table 2) as detailed in the Methods section.                                 median of 131 seconds for the biexponential function compared to
    Another important difference between the two fitting functions                      a median of 4.10 seconds required for the implementation of the
is the minimum camera responses included in the OECF: the rmin                          Bézier approach.
value. The precise value for rmin was found to be a factor
influencingg the number of Bézier segments required to accurately                      Discussion
fit the OECF curve (Figure 2, panel B). Although complex curves
                                                                                           With the growing use of digital imaging for quantifying the tonal
can be accurately fitted using several Bézier segments rather than a
                                                                                        and spectral characteristics of radiations reflected from various
single Bézier curve [30], for the purpose of camera characterisa-
                                                                                        object matter [1,2,11,12,14–16], it is important to have accurate
tion, it is desirable to fit the entire OECF curve using a single                       methods for specifying the relationships between input irradiance
segment in such way that the LUT required for recovering the                            signal and camera output for quantitative analyses. In spite of
linear camera values can be constructed applying an equation-                           being sensitive to different regions of the spectrum, the OECF
based interpolation (Equation 3) from a single Bézier segment.                         curves of the two tested cameras present a notable similarity in
rmin values were set at 31 and 37 pixel intensity values for the                        their general form (Figure 1). This result indicates a close likeness
Canon and Nikon camera respectively, corresponding to the first                         between the gain functions applied to the sensor response of the
control point (P0 ) on the Bézier curve. On the other hand, the                        two cameras. The use of non-linear gain functions which
biexponential function accurately fitted the entire OECF curve,                         asymptotically approach to rmax is characteristic of different
eliminating the need for a rmin value (Figure 2, panel A).                              consumer-level digital cameras as a strategy for increasing their
dynamic range [22,29]; a commonly desired feature for commer-                  accurately linearised. Camera responses below rmin follow a
cial photography, but a limitation for quantitative image analysis             distribution different from the remaining OECF curve [2,36], and
[2]. Therefore the present method is potentially applicable to other           including them may prevent attaining an adequate fit with the
camera models presenting a similar gain function, including those              selected programming code. The precise value of rmin varies from
cameras capable of producing images from reflected near-                       one camera to another and must be found empirically, which is
ultraviolet radiation [1,23].                                                  again a limitation compared with the biexponential approach
   Even though the two proposed characterisation and linearisa-                (Figure 2, panel A). Although it is possible to fit the entire OECF
tion methods accurately recover the linear camera response                     curve, including the low response region, implementing several
(Figure 3, Table 3), they differ in the magnitude of the uncertainty           Bézier segments rather than a single Bézier curve (Figure 2, panel B),
associated with the recovered radiometric information. Irrespec-               this approach has the limitation of producing LUT tables whose
tive of the selected linearisation method, a graphical depiction of            values do not uniformly cover the entire OECF curve, but are
the gain function, i.e. the OECF curve (Figure 1), in conjunction              clustered along different regions of varying length along the curve
with a plot of the standard deviation as a function of exposure level          corresponding to the different segments (Figure 2, panel B). This
(Figure 4), provides a guideline for establishing the maximum                  arrangement of the LUT values makes it necessary to resort to
camera response included in a given image and its corresponding                interpolation techniques to recover linear values corresponding to
exposure value. By establishing these two criteria it is possible to           r values located on non-sampled regions of the OECF, thus
define precise exposure parameters, f-number and shutter speeds,               introducing an additional step in the computation and increasing
for attaining a standardised exposure, which in turn allows for an             the uncertainty bounds of the recovered linear response. Contrary
objective comparison among images recorded with the same                       to the use of Bézier fitting techniques, the implementation of a
camera.                                                                        biexponential function does not require the use of a rmin value as it
   Selecting r values corresponding to g values located before the             accurately fits the entire OECF curve including extremely low
region of increasing standard deviation has the advantage of                   camera responses (Figure 2, panel A). This characteristic of the
ensuring the recovery of linear camera responses with the lowest               biexponential function is particularly convenient when recon-
possible uncertainty for a given camera system/colour channel                  structing spectral sensitivity curves, as it removes the necessity to
combination; however, other factors such as the intensity of the               modify the exposure parameters to increase the camera’s response
signals produced by study object itself should also be considered              at wavelengths where the sensitivity is very low.
when selecting the gmax value.                                                    Even though the two methods differ in the number of
   One of the most common applications of linear camera                        parameters that need to be estimated to fit a curve, in the present
responses is for reconstructing spectral sensitivity curves [3],               application, only four parameters need to be estimated by either
defined as the ratio of linear camera response to incident energy at           method. Camera characterisation by means of a biexponential
different wavelengths across a given spectral interval [33]. Camera            function requires estimating four parameters, corresponding to the
characterisation by means of a biexponential function and the                  two coefficients included on each of the biexponential terms here
subsequent recovery of linear camera responses and their                       represented by the letters b, c, d and g (Table 1 and Equation 4).
associated standard deviation after inverting the fitting function             Even though in principle camera characterisation by cubic Bézier
(Equation 4) is particularly useful in this case, as the linearised            curves requires finding a total of eight parameters represented by
responses are expressed in the same units as the energy input                  the g=gmax and r=rmax values for each of the four control points
(Table 2). Furthermore, the number of camera responses required                defining the curve in Equation (3), two of these points, P0 and P3 ,
for this application allows for a precise recovery of the linear               are predefined by setting rmin and by the highest r included in the
camera responses whilst keeping the computational time at                      OECF, so again there are only four free parameters.
reasonable levels. On the other hand, the use of Bézier curves                   From our results it can be concluded that both biexponential
for this purpose not only requires an extra step represented by the            functions and cubic Bézier curves overcome the limitations of
multiplication of the recovered linear response by a separately-               power and exponential functions to completely characterise the
measured value of gmax , but has the shortcoming of the wide                   OECF curve of cameras equipped with a Bayer filter array.
uncertainty bounds associated with extremely low and high                      Although either of the two methods can be used for accurately
exposure values (Figure 3).                                                    recovering total irradiance at a given pixel location, the selection
   When the objective is to quantitatively analyse images                      of a particular method should be based on: (i) the final objective of
representing complex scenes including large areas widely varying               using linear camera responses, and (ii) the potential implications of
in irradiance levels (brightness), or when the entire photographic             differences in the magnitude of the uncertainty associated with the
frame has to be analysed, a researcher faces different require-                recovered linear camera responses.
ments. In these, and other biology-related studies involving                      When the objective is to reconstruct spectral sensitivity curves,
imaging such as characterisation of animal colour patterns,                    camera characterisation by means of biexponential functions is the
camouflage studies, modelling non-human visual spaces and                      best approach. These functions accurately model the entire OECF
animal-plant interactions [1,2,11,12,34,35], the efficiency of the             curve including the extremely low camera response and saturation
Bézier technique may overcome the wider uncertainty levels                    region thus making unnecessary the use of ad hoc parameters,
associated with this methodology (Figure 3); in particular, when               namely the rmin value. Moreover camera characterisation by this
the digital images to be linearised consist of several megapixels.             method allows for a precise estimation of the normalisation
Yet in this case a biexponential linearisation function can be                 parameters required for the implementation of Bézier fitting
efficiently implemented if a LUT is constructed for linearising the            techniques.
images rather than directly inverting the function for the camera                 On the other hand, cubic Bézier curves have the advantage of
response at each pixel location as was done here.                              permitting the recovery of linear camera responses and their
   In contrast to the biexponential fitting function, the cubic Bézier        associated uncertainty bounds in a computationally-efficient
curve requires establishing a minimum pixel response value (rmin ). This       manner through the implementation of a formula-based interpo-
value corresponds to the first control point of the fitting curve              lation. When implementing this method, the required look-up-
(Figure 1) and represents the lowest camera response that can be               tables are constructed by simply inverting the axes, making
unnecessary the implementation of numerical approximation                                      responses. However the main differences between the two methods
algorithms such as those required for inverting the biexponential                              consist on the amount of uncertainty associated with the recovered
fitting function. Nevertheless when implementing this method it is                             irradiance and the means by which the two functions are inverted.
still important to consider the wider uncertainty bounds compared                              Recovering of irradiance values by implementing biexponential
to those obtained by implementing the biexponential approach.                                  functions results in consistently reduced uncertainty bounds, but
    Finally, by selecting adequate rmin and rmax values it is possible                         the inversion of such a function requires resorting to optimisation
to establish precise and standardised minimum and maximum                                      techniques requiring longer computational times. On the other
exposure parameters thus permitting the objective comparison and                               hand, recovery of irradiance values employing Bézier curves
quantitative analysis of the reconstructed images. These images                                requires shorter computational times, is more intuitive and easily
accurately reconstruct two-dimensional information from real,                                  achieved with linear interpolation through the use of LUTs. The
complex scenes, which should have high value for biological                                    application of these methodologies makes it possible to accurately
imaging and other quantitative image analysis applications.                                    recover total irradiance information from complex scenes,
                                                                                               enabling investigations such as the study of animal vision in
Conclusions                                                                                    natural settings.
   Our results introduce two different methodologies for recover-
ing irradiance information, at each pixel location, within a digital                           Author Contributions
image recorded with RGB cameras sensitive to visible and UV                                    Conceived and designed the experiments: JEG ADG GS PAW. Performed
irradiation. Both methods achieve this by fitting a mathematical                               the experiments: JEG. Analyzed the data: JEG ADG PAW. Contributed
function to the OECF curve (gain function) of the camera and                                   reagents/materials/analysis tools: GS PAW. Wrote the paper: JEG AGD
subsequently inverting it to solve for exposure from camera                                    ADG GS PAW.
References
 1. Pike TW (2010) Using digital cameras to investigate animal colouration:                    19. Westland S, Ripamonti C (2004) Computational Color Science Using
    estimating sensor sensitivity functions. Behav Ecol Sociobiol 65: 849–858.                     MATLAB. Chichester, England: John Wiley.
 2. Stevens M, Párraga CA, Cuthill IC, Partridge JC, Troscianko TS (2007) Using               20. Bérube Y, Gingras D, Ferrie FP (1999) Color camera characterization with an
    digital photography to study animal coloration. Biol J Linn Soc Lond 90: 211–                  application to detection under daylight. Vision Interface, Trois-Rivières,
    237.                                                                                           Canada.
 3. Alsam A, Lenz R (2007) Calibrating color cameras using metameric blacks. J Opt             21. Cheung V, Westland S (2003) Accurate estimation of the non-linearity of input-
    Soc Am A 24: 11–17.                                                                            output response for color digital cameras. In: IST PICS Conference. The Society
 4. Alsam A, Finlayson GD (2007) Metamer sets without spectral calibration. J Opt                  for Imaging Science and Technology, 366–369.
    Soc Am A 24: 2505–2512.                                                                    22. Kawai S, Morimoto M, Mutoh N, Teranishi N (1995) Photo response analysis in
 5. Heikkinen V, Lenz R, Jetsu T, Parkkinen J, Hauta-Kasari M, et al. (2008)                       CCD image sensors with a vod structure. IEEE Trans Electron Devices 42: 652–
    Evaluation and unification of some methods for estimating reflectance spectra                  655.
    from rgb images. J Opt Soc Am A 25: 2444–2458.                                             23. Garcia JE, Wilksch PA, Spring G, Philp P, Dyer AG (2012) Characterization of
 6. Morovic P, Finlayson GD (2006) Metamer-set-based approach to estimating                        digital cameras for reflected ultraviolet photography; implications for qualitative
    surface reflectance from camera RGB. J Opt Soc Am A 23: 1814–1822.                             and quantitative image analysis during forensic examination. J Forensic Sci doi
 7. Shimano N, Terai K, Hironaga M (2007) Recovery of spectral reflectance of                      10.1111/1556–4029.12274.
    objects 380 being imaged by multispectral cameras. J Opt Soc Am A 24: 3211–                24. Williams AR, Williams GF (1993) The invisible image–a tutorial on
    3219.                                                                                          photography with invisible radiation, part 1: Introduction and reflected
 8. Shimano N, Hironaga M (2010) Recovery of spectral reectances of imaged                         ultraviolet techniques. J Biol Photogr 61: 115–132.
    objects by the use of features of spectral reflectances. J Opt Soc Am A 27: 251–           25. Ray S (2002) Applied Photographic Optics. Oxford, UK: Focal Press, third
    258.                                                                                           edition.
                                                                                               26. ISO (2009) Photography-electronic still picture cameras-methods for measuring
 9. Zhang X, Xu H (2008) Reconstructing spectral reflectance by dividing spectral
                                                                                                   opto-electronic conversion functions (OECFs). Technical Report 14594,
    space and extending the principal components in principal component analysis.
                                                                                                   International Organisation of Standardisation.
    J Opt Soc Am A 25: 371–378.
                                                                                               27. Dyer AG, Muir LL, Muntz WRA (2004) A calibrated grey scale for forensic
10. Martı́nez-Verdú F, Pujol J, Capilla P (2003) Characterization of a digital camera
                                                                                                   ultraviolet photography. J Forensic Sci 49: 1056–1058.
    as an absolute tristimulus colorimeter. J Imaging Sci Technol 47: 279–374.
                                                                                               28. Schneider C, Rasband W, Eliceri K (2012) NIH Image to ImageJ: 25 years of
11. Young MJ, Simmons LW, Evans JP (2011) Predation is associated with variation                   image analysis. Nat Methods 9: 671–675.
    in colour pattern, but not body shape or colour reflectance, in a rainbowfish              29. Allen E, Bilisi E (2011) Digital cameras and scanners. In: Allen E,
    (Melanotaenia australis). J Anim Ecol 80: 183–191.                                             Triantaphillidou S, editors, The Manual of Photography, Oxford: Focal
12. Shrestha M, Dyer AG, Boyd-Gerny S, Wong BBM, Burd M (2013) Shades of                           Press/Elsevier, chapter 14. 263–288.
    red: Bird-pollinated flowers target the specific colour discrimination abilities of        30. Hansford D (2002) Bézier techniques. In: Farin GE, Hoschek J, Kim MS,
    avian vision. New Phytol 198: 301–307.                                                         editors, Handbook of computer aided geometric design, Boston: Elsevier,
13. Garcia JE, Rohr D, Dyer AG (2013) Trade-off between camouflage and sexual                      chapter 4. 75–93.
    dimorphism revealed by uv digital imaging: the case of Australian mallee                   31. Khan M (2009). Cubic bezier least square fitting http://mathworks.com.au/
    dragons (Ctenophorus fordi). J Exp Bio doi 10.1242/jeb.094045.                                 matlabcentral/fileexcahnge/15542-cubic-bezier-least-square-fitting.
14. Lahuerta Zamora L, Pérez-Gracia MT (2012) Using digital photography to                    32. L’Ecuyer P (2012) Random number generation. In: Gentle JE, Hardle WK,
    implement the McFarland method. J R Soc Interface 9: 1892–1897.                                Mori Y, editors, Handbook of computational statistics, Springer, chapter 2. 35–
15. Zamora LL, Mellado Romero AM, Calatayud JM (2011) Quantitative                                 71.
    colorimetric analysis of some inorganic salts using digital photography. Anal              33. Lee HC (2005) Introduction to Color Imaging Science. Cambridge: Cambridge
    Lett 44: 1674–1682.                                                                            University Press.
16. Wright FD, Golden GS (2010) The use of full spectrum digital photography for               34. Stevens M, Cuthill IC (2006) Disruptive coloration, crypsis and edge detection in
    evidence collection and preservation in cases involving forensic odontology.                   early visual processing. Proc R Soc Lond B Biol Sci 273: 2141–2147.
    Forensic Sci Int 201: 59–67.                                                               35. Cassey P, Thomas GH, Portugal SJ, Maurer G, Hauber ME, et al. (2012) Why
17. Jenkin R (2011) Image sensors. In: Allen E, Triantaphillidou S, editors, The                   are birds’ eggs colourful? eggshell pigments co-vary with life-history and nesting
    Manual of Photography, Oxford: Focal Press/Elsevier, chapter 9. Tenth edition,                 ecology among British breeding non-passerine birds. Biol J Linn Soc Lond 106:
    155–173.                                                                                       657–672.
18. Holst GC, Lomheim TS (2007) CMOS/CCD Sensors and Camera Systems.                           36. Barnard K, Funt B (2001) Camera characterization for color research. Color
    Bellingham, Washington, USA: SPIE Press.                                                       Res Appl 27: 152–163.