Pretty darn good - at least if you have a Pentax K-1, K-3, or Q7.
Have you ever wondered how your camera was responding to the light incident on the sensor?
Optical astronomers worry about this a lot: most telescope cameras these days have CCD detectors very similar to those in our cameras. Most research with these cameras requires an accurate measure of “how bright/how much light” is being detected. Generally, the CCDs are quite linear - more light gives more signal (more charge stored in a CCD pixel) in a 1-to-1 relation (after nuisance corrections such as bias frames, dark frames, flat fielding, etc.).
So, I was curious about my Pentax cameras in this regard.
How do you measure it? The easiest way is to take a series of exposures of, say, a gray card with constant illumination using different shutter speeds and determine the pixel values that result. (One could also vary f-stop or even ISO, but shutter speed is easy to change over a wide range, and, according to my measurements, exceedingly accurate in most cases.)
This is not quite as simple as it sounds, though. The problem is getting the raw pixel data out of the camera. Pretty much all programs which display images for us on our PC monitors interpret the data in distinctly non-linear ways. For example, here is what Photoshop Elements (PSE) displays as a function of shutter speed over a range of almost 10 stops (the different colors lie nearly on top of each other, since a custom white balance was set):
If PSE was linear, the results should look like this:
After some web searching and a question here, the solution to getting the raw data out (short of writing my own program to take advantage of dcraw software (
dcraw - Wikipedia)) was to use the RawDigger (RD) software (
RawDigger | Everything You Always Wanted to Know About Raw(But Were Afraid to Ask)). RawDigger reads in camera RAW files, and will report the actual R, G (two values, since most cameras with Bayer grids actually have twice as many green-sensitive photosites as red or blue), and B values measured by the camera sensor, along with various statistics.
I used a Gretag-Macbeth 24-square Color Checker card and set RD to measure 3 or more of the white-gray-black squares at the bottom of the card. I set a custom white balance for my lights (see next paragraph), and then made exposures over a wide range of shutter speeds, typically from around 1/500 to several seconds, in half-stop intervals (for the Q7 and a Canon G15, I used 1/3 stop intervals, since these are the only option). ISO was set at 100, and a typical f-stop was 4. Some diffusing plastic ensured uniform lighting of the target. The results shown below have been corrected for the “incorrect” shutter speeds displayed by a camera (
True Shutter Speeds compared to Nominal Shutter Speeds - Actual Measurements - PentaxForums.com ). Thus, all shutter speeds have the correct square root of 2 (cube root for the Q7) values.
My first attempt came to a halt when I realized that the results were obviously inconsistent at short shutter speeds (1/60 second and shorter) just from looking at the images- the brightness varied all over the place. I quickly realized I was seeing effects due to the 60 Hz power line frequency. I was using line-powered LED lights initially and they respond quickly to the fluctuating voltage. I cured the light fluctuation by using a DC power supply to run other LED lights, some 12 V mini-floods (for the K-1 exposures) and a pair of 6V work lights for the K-3 and Q7 results.
I put all the RD data into excel spreadsheets for analysis and display.
Here are the results for my K-1, in all three colors (the green values have been averaged here):
The results show phenomenal linearity, for at least 10.5 stops in the blue! I have been taking scientific data for more than 50 years (in the lab and actual astronomical data), and I have NEVER seen anything so good. For perfectly linear data, the power of x in the power law fits should be exactly one. The values here deviate by less than a percent from that. The R-square value indicates the goodness of fit in excel. 1 indicates a perfect fit, and these are that good to 4 digits or so. At the very low end (pixel values below 10) seen on the darkest squares (not shown here), the values are a bit above the fit line, almost certainly due to noise at such low values. The largest pixel data values for the K-1 (and K-3) are 16316 - just slightly below the absolute maximum we might expect for 14 bits: 2^14 = 16384 . Looks like Pentax left themselves a bit of breathing room at the top of their analog-to-digital converter. Values approaching 16000 appear to be real (i.e. actually represent true variations in light intensity).
Here are the K-3 results:
Again, phenomenal fits and superb linearity, over at least 11 stops (in the blue). The powers here are a bit bigger then one, but only by a percent or two, with goodness of fit coefficients again close to one. This time, too, the maximum pixel values reported are 16316, consistent with the expected 14 bits.
The astute observer will note that the relative strength of the blue and red data have switched between the plots. Some of that may be due to the relative color sensitivity of the two sensors, but I think it could also be an effect of the relative color content of the LED lights that were used. The K-3 lights were definitely bluer.
And, finally, the Q7 results:
And, once more, the camera sensor is exceedingly linear over more than 10 stops, with powers very close to unity and goodnesses of fit very close to one as well. The exposures here are mostly for full stop steps, with just a few at intermediate 1/3 stop values. The maximum pixel values now are around 4060 - again, slightly lower than the maximum for 12 bits: 2^12 = 4096. This time, the red and green data lie nearly on top of each other. The lighting here is the same as used for the K-3. Evidently, the Q7 relative sensitivity to red and green is different than for the K-1 and K-3.
I made some similar measurements with my Canon G15. The results, while still quite linear, are not nearly as good as for these Pentaxes. There are kinks in the curves around shutter speeds of 1/20 second. And for exposure times of more than a second, the camera insisted on changing the ISO from 100 to 80. Correcting for the ISO sensitivity change did not quite restore linearity. Just realized: I need to try properly accounting for the 1/3 stop step size in ISO - hmmm, that’s a less than 1 per cent effect for that step - not big enough to explain the effects I see.
Another question of interest, alluded to at the top of this discussion, is how the actual pixel values are displayed by Photoshop as RGB values. I will address this in a second write-up real-soon-now.