Changing the topic a bit.

I was trying to understand how Roger Clark

figured out the full well capacity in electrons, so I've implemented a fairly similar method in raw_diag.

Click for his analysis of

5D3,

6D,

5D2 and

7D.

**Basic theory:**- SNR curve can be estimated from the difference of two test images, taken with identical settings, from a static scene.

- Roger recommends shooting a out-of-focus white wall and take a bunch of images. I went for something much easier (but less accurate): simply shoot a out-of-focus HDR scene (with both deep shadows and clipped highlights) and take two test pictures. I think it's enough for our purposes.

- The difference will contain noise multiplied by sqrt(2), because noise from two subsequent images is not correlated (well, mostly).

- If you take small patches of the same color, we can say the patch average (taken from one of the test images) is the input signal, and the patch stdev (taken from the difference image) is the noise level at that input signal. So, we have all we need to plot the SNR curve.

**Curve fitting:**- Now, we can fit an ideal model for the SNR curve. I'll use one that combines read noise (assumed constant additive Gaussian) and shot noise (which follows Poisson statistics). Something like this:

`dn = patch_average - black_level;`

electrons = dn * gain;

shot_snr = sqrt(electrons);

shot_noise = dn / shot_snr;

combined_noise = sqrt(read_noise*read_noise + shot_noise*shot_noise);

model_snr = log2(dn) - log2(combined_noise);

- So, we have a model with two parameters (read_noise and gain), that gives an ideal SNR. We can compare that SNR with measured values (from the SNR curve) and minimize the difference between our model and our measurements.

- Robust statistics tricks / speedup: we have up to 20000 data points; a few of them are outliers, but most of them are OK. I've grouped them into bins, every 0.5 EV, and took the median from each bin. So, now I have up to 28 data points, without outliers. Clean and fast

- Since I don't know how to find a closed-form solution for the best fit (if you know how, please enlighten me), I went for a very simple minimization routine: at each step, choose a random point nearby and evaluate the function there; if it's better, keep it, if not, discard it. It does the job.

**My results:**I've only tested ISO 100 and 1600 in photo mode.

**Wanted: your results**

1. grab

**raw_diag.mo** (no need to compile anything, just place it in your MODULES folder).

2. use 1/50 for PAL, 1/60 for NTSC, or any shutter speed if you don't use artificial lights.

3. point the camera to a out-of-focus HDR scene, and adjust ISO and aperture to get a good picture (both clipped highlights and fairly deep shadows).

4. enable Debug->RAW Diagnostics, and from there, select "

**SNR curve (2 shots)**". Disable the other analyses types (unless you want them). Make sure "Auto screenshot" is enabled (it is by default).

5. take the two test pictures from Debug -> RAW Diagnostics -> Dummy bracket. Simply click it once and wait until it's finished.

6. post the screenshot (it's called SNR2.PPM and it's saved under the RAW_DIAG folder; convert it to PNG first to make it smaller, and give it a meaningful name).

I'm looking for results covering

**all ISOs**, for

**all cameras**, both

**photo** and

**movie** mode.

If you wish to review the code or compile yorself, look

here.

Have fun!