On Wed, Aug 5, 2009 at 6:01 AM, Larry Colen<[email protected]> wrote:

> What I'd love is a program that I could give a JPEG, or a PEF and get
> back a measurement of the SNR, though I suspect with images you are
> interested in both the amplitude of the noise, and the percent of
> pixels that have that much noise.

I don't know if anyone's written something like that (that you can get
your hands on), or how easy it is to get at the data through dcraw or
libraw or something.  But in principle, here's how I would start:

You definitely want to work with raw, not JPEG, and preferably
non-debayered raw data.  I would take a raw frame, and convert it to 3
or 4 single-color images (a "red" image consisting of only the red
pixels, and "blue" image consisting of only the blue pixels, and one
or both "green" images consisting of green pixels).  These will be
half the size, in each dimension, of the original image.

Take two identical exposures of the scene, and convert them to
single-channel images as described above.  Subtract them (e.g. red
image 1 minus red image 2).  You now have a "noise" image.  Because of
the subtraction, the noise in this image is sqrt(2) higher than in the
original image.  (I am assuming Gaussian noise throughout.)  If you
divide the noise image by sqrt(2), and then calculate the standard
deviation of pixel values in some region that's uniform in the
original image (like your gray square or black square, but not both
together), you'll get a measure of the noise in that channel, in that
region of the images.

For signal-to-noise, you basically want to divide that value by the
mean of the original (red, green, or blue, whichever you're working
with) in the same region, but I think there are complications here.
The "signal" image has to be at zero for "no signal" (no photons).
There may be some bias that makes it read more than zero for no
signal.  In a research CCD, there's an "overscan" region that reads
out bins (pixels) that don't actually exist (literally, you have 2048
pixels and read out 2096 or so... the last 48 recorded no photons,
since they don't exist).  You can subtract off that overscan to debias
the frame.  I don't know exactly how you would do that with DSLR
images... I've never worked with them at this level.  Note that with
debiased data, the pixel values in dark parts of the scene may be
below zero (due to the effect of noise on "true" values near zero).
Be sure to use a signed data type.

--
PDML Pentax-Discuss Mail List
[email protected]
http://pdml.net/mailman/listinfo/pdml_pdml.net
to UNSUBSCRIBE from the PDML, please visit the link directly above and follow 
the directions.

Reply via email to