A simulation of SNR in image resampling
Hi,
I'm not fluent in Matlab code, so I may not yet see exactly what you're doing, but correct me if I'm wrong.
1. You seem to basically assume that the image is noise free (or at least the noise is considered as pure signal).
2. You add (shot-)noise with a Poisson distribution, in line with the signal levels.
3. You add uniform (read-)noise with a Gaussian distribution.
The difference between the image (1) and the result of (1+2+3), or the sum of (2+3), is basically a signal level weighted total noise only image.
4. You upsample/downsample the separate signal image and the separate total noise image.
5. You calculate the dB of the S/N ratio
Questions/observations:
ad 1: The signal image already has a mix of shot and read noise, and demosaicing of all that.
ad 2: The poisson noise should be a function of the number of photons, so for an ISO 100 image white would probably be close to 65535 photons, but might be higher or lower depending on (pre and post) ADC conversion gain. It's the square root of those quantities that would dictate the actual Poisson noise standard deviation. Also, and I know it's difficult to create a signal only image, adding Poisson noise to the already 'noise infested' signal levels, would increase the standard deviation. So for higher precision you'd probably have to correct the assumed level of 'shot'noise by some factor. Maybe not by dividing it by sqrt(2), because the demosaiced image will not have the pure Raw read+shotnoise signature, but it might be closer than not correcting it at all.
ad 3: Similar considerations, adding Gaussian distributed noise to an already 'noise infested' Raw converted image will increase the standard deviation, and mixing different types of uncorrelated noise will change the distribution to something more Gaussian than Poissonian. Not that it would have a large impact in general, but dark images would be more affected by this than relatively bright images, so there is some image content bias to be expected.
ad 4: The problem with interpolating uncorrelated noise is that the fluctuations can be relatively large between neighboring pixels. Given that the Lanczos (a Sinc windowed Sinc) FIR filter exhibits over- and under-shoots (ringing) at the immediate neighbors, may overestimate the standard deviation. It will also do more of that at higher image signal levels and less at lower image signal intensity levels, so average image brightness will introduce a bias.
ad 5: Photographers are more familiar with S/N ratios than with (electro/acoustical) engineering decibels. As for the latter one could debate whether to use a multiplier of 10 or 20 to the logarithm base 10 of the S/N ratio, I'm not sure. I prefer S/N ratios, also to avoid having to interpret logarithms.
While I understand that it may be useful to apply some sort of signal level weighting to the noise distribution spectrum, I've always found it very useful to up- and down-sample uniform (white) noise images (which incorporates all spatial frequencies). It's then much easier to make a logarithm of a Fourier transform magnitude image, and visualize the noise spectrum (as an image or periodogram and/or as a noise spectrum plot).
Alternatively, even if only to verify the validity of the above method you outlined above, one could use a sinusoidal grating of known period to simulate a single spatial frequency (or a
zoneplate with many, in many isotropic orientations), and add noise to that and resample that in order to study a specific spatial frequency and the effect the resampling algorithm also has on the signal, not only on the noise.
Fun stuff, isn't it?
Anyway, folks like (
me and)
Jim Kasson also did some up/down-sampling analysis on noise in the specific context of different resampling algorithms, which is another can of worms.
Cheers,
Bart