Since the camera's gamma correction is based on brightness and not on color,
we have used the six greyscale swatches of the Macbeth ColorChecker to
find the gamma function. We use the Y values given by the spectroradiometer
and the RGB values given by the camera for each swatch.
We found the gamma function for each of the red, green, and blue values
individually. The first step was to establish normalized data for each
of the gray swatches. This is the procedure we followed:
With the normalized vectors, we were able to find the gamma and inverse
gamma functions. The gamma function is evident when we plot the normalized
greyscale RGB nonlinear values as a function of the normalized greyscale
Y values.

Since the Y values are assumed to vary linearly with the linear RGB values, this plot gives the relationship between the nonlinear RGB values and the linear RGB values. We fit the curve using a nonlinear curve-fitting function (described in the appendix) and arrived at the following gamma functions:
Rnon = 1.045*Y.5312
Gnon = 1.0410*Y.5406
Bnon = 1.0413*Y.5437
To find the inverse gamma function, we plotted the Y values as a function
of the nonlinear RGB values and performed the same curve-fitting routine.
These are the functions we found for converting nonlinear RGB values to
linear RGB values:
Rlin = .9521*Rnon2.150
Glin = .9583*Gnon2.0750
Blin = .9554*Bnon2.05
Note that these functions are designed for normalized values. We have compiled
these inverse gamma functions into a MATLAB function, tolinear.m that
will convert nonlinear RGB values to linear RGB values for this project.