How does "total light" change SNR? II

This, conceptually, is easy to achieve by calculating a Fourier transform of the 3000px picture, and multiplying the result (in the frequency domain) with a brick-wall filter.
Isn't that going to ring like crazy?
Suppose that we place a digital camera on a copy stand and take a picture of a chessboard.

The camera's lens projects on the sensor surface a reduced, sharp image of the chessboard.

The pixels on the sensor capture the chessboard's square, dark and bright patterns, and the camera records the picture in an image file.

Suppose that we take the chessboard's picture first with a camera that has a full-frame 24-megapixel sensor, and then with another full-frame camera that has a 12-megapixel sensor, using the same lens.

Comparing the 24-MP and 12-MP pictures, we might notice a slight loss in sharpness in the delineation of the black and white squares of the chessboard.

What we certainly won't notice, however, is any kind of "ringing" occurring in the vicinity of the chessboard's black / white transitions, even on the picture taken with the lower-resolution camera.

In fact, even if we used a camera that had an extremely low-resolution sensor with only a few hundred pixels, I think it's obvious that there wouldn't be any ringing in the picture. The only effect that a lower-resolution sensor would bring is that the chessboard's picture would be fuzzier, less detailed.

The Nyquist-Shannon sampling theorem tells us that any monochromatic sensor that had a resolution higher than 8 pixels by 8 pixels should be able to record well enough a 8x8 chessboard's dark and light patterns: the imaging sensor simply samples the spatial data that's projected onto it, and is, in principle, able to record without aliasing all the spatial frequencies lower than its Nyquist limit.

The downsampling method I've described in my previous post, which combines a sinc convolution followed by a Dirac comb multiplication, is actually a good simulation of the sampling by an arbitrary sensor of the spatial data projected onto it.

The only restriction of the downsampling method I described is that it can (obviously) only simulate a sensor whose resolution is lower than the resolution of the original picture that we're downsampling.

The sinc function is a continuous function, and the sinc convolution process therefore recreates a continuous signal. This reconstruction is a faithful reproduction of the analog, continuous spatial frequency modulation pattern that's projected on a sensor.

Another key characterstic of this continuous, analog-like reconstruction is that it's bandwidth-limited by the brick-wall filter.

The sinc convolution process is therefore implementing a perfect low-pass filtering, which a causal, physically implementable birefringent optical low-pass filter (OLPF) sitting in front of a sensor can never achieve.

This virtual, reconstructed continuous signal is thus perfectly low-pass filtered, and then sampled by the multiplication with a Dirac comb, thereby reproducing the sampling process of the spatial frequencies projected by the lens on the sensor's OLPF and discrete pixel array stack.

The quality of this analog reconstruction is a consequence of the sampling theorem, and, similarly to the fact that a camera's sensor won't generate ringing when photographing a chessboard, a sampling by a Dirac comb of the analog-like reconstruction won't generate any ringing.

To show the absence of ringing, I've written a small demonstration routine in the C programming language. This convolution demo, which I've named "convsinc" and uploaded to Pastebin , downsamples a 1-D input vector of floating-point numbers (sorry, I was too lazy to implement downsampling of 2-D data) and then simply outputs the downsampled 1-D array as a list of floating-point numbers.

Downsampling with that routine a numerical input vector containing a step function — e.g. [1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2] — will yield e.g. as output a smaller numerical vector like [1,1,1,1,2,2,2,2]. The use of double precision floating-point input and output data ensures that ringing or even tiny overshoots and undershoots e.g. in downsampled step functions would be obvious if they occurred.
I think there's good reason why we're not using brick wall AA filters. If you disagree, can you help me out there?
Brick-wall filtering / sinc convolution is very computation-intensive, and I think that for most continuous-tone, photographic material, the quality improvement it delivers is very marginal.

Thus, fast and efficient methods like bilinear or low-pass filtering with small convolution kernels is, IMHO, more than good enough for most uses.
 
Last edited:
With packings that map a non-integer number of original pixels into one down sampled pixel, the straddling position is going to progressively shift.

This position shift could be seen as a type of phase modulation.

Phase modulation — and jitter, which is also a kind pf phase modulation — applied to a pure sinusoidal wave widens its spectrum. Hence my suspicion that with non-integer packings, the spectrum would also be widened a bit, adding some energy to the high frequencies.
 
Down at the other end of the electromagnetic spectrum, the radio noise from our galaxy is so large that radio receivers become "external noise limited". This means that as you improve the antenna efficiency to bring in more signal, you also bring in more external noise, so the SNR doesn't improve. I was trying to think of an analogous situation with photography... maybe photographing through a thick fog in bright sunshine, where a wider aperture wouldn't help to improve the contrast...
Happens in astronomy with light pollution. Narrow-band filters help.

Jim
Yes - that's a much better example...

J.
 
This, conceptually, is easy to achieve by calculating a Fourier transform of the 3000px picture, and multiplying the result (in the frequency domain) with a brick-wall filter.
Isn't that going to ring like crazy?
Am I an idiot, or what.

First, I upload to Pastebin an early, test version of my code where the careless editing and simplification / factoring of some mathematical expressions had completely removed an indispensable scaling factor in the convolution calculation.

Second, and much more importantly, my comment about the sinc filtering and Dirac combing emulating well enough the actual physical process which takes place when a camera lens projects a pattern on a discrete pixel array is utterly wrong.

Pixels have finite dimensions, and thus necessarily perform some integration of the spatial modulation projected onto it, creating, besides the Nyquist aliasing issue, an additional low-pass filtering effect.

OTOH, a Dirac comb is infinitely thin, and, besides the Nyquist aliasing issue, doesn't affect the spectral content of the signal.

Furthermore, as the "pulse" initialization function in the demo code illustrates, a brick-wall filtering (multiplication with a rect function in the frequency domain) must necessarily correspond, in the spatial domain, to a convolution of the input pulse with the Fourier dual of the rect function, that is, a sinc function.

As the result of convolving a pulse with a sinc must necessarily look like a sinc, the brick-wall filtering will necessarily introduce, as you point out, some ringing.

This ringing is well present in the results spit out by the correct version of the convolution demo code.

Feeding into a spreadsheet's graph module the numerical data spit out by the demo code when downsampling a pulse {... 1,1,1,1,2,1,1,1,1 ...}, the result looks like this:

Obvious ringing caused by brick-wall filtering and downsampling an ideal pulse.
Obvious ringing caused by brick-wall filtering and downsampling an ideal pulse.

Besides avoiding computational complexity, this is an area where alternative downsampling principles — e.g. the "connect the dots"-like approach of bilinear downsampling — show their value by minimizing the ringing — albeit at the expense of frequency content integrity.
 
Last edited:
Am I an idiot, or what.
There's that word again. However, applied reflexively, you get a pass. We all make mistakes, and one of the great things about this forum -- most of the time -- is that we support each other when that happens, rather than flame. Thanks for being true to that tradition.
Pixels have finite dimensions, and thus necessarily perform some integration of the spatial modulation projected onto it, creating, besides the Nyquist aliasing issue, an additional low-pass filtering effect.

OTOH, a Dirac comb is infinitely thin, and, besides the Nyquist aliasing issue, doesn't affect the spectral content of the signal.

Furthermore, as the "pulse" initialization function in the demo code illustrates, a brick-wall filtering (multiplication with a rect function in the frequency domain) must necessarily correspond, in the spatial domain, to a convolution of the input pulse with the Fourier dual of the rect function, that is, a sinc function.

As the result of convolving a pulse with a sinc must necessarily look like a sinc, the brick-wall filtering will necessarily introduce, as you point out, some ringing.
That makes complete sense.

However, there is hope from another front. Bart van der Wolf, using ImageMagick, has tested a downsampling algorithm called "Blended Keys Cubic EVA with deconvolution sharpening" on the mu=1/2, sigma= 0.1 image, and the results are almost perfectly in line with the behavior we're looking for, and no funny business at 1/2 magnification. This algorithm is reported to do well wrt AA and artifacts.

I plan to download ImageMagick and attempt to duplicate his results. I also want to check on the behavior of the Ps downsampling algorithms wrt noise.

Thanks,

Jim
 
There were a few lengthy threads on Lula (e.g. http://www.luminous-landscape.com/forum/index.php?topic=92767.0) around posts and videos by Gary Fong and Will Crocket trying to explain why Adobe RGB is worse than sRGB, and showing what happens when you convert from Adobe RGB to sRGB:

657976364ca84957a14bd463ae9d8697.jpg
Except he (Gary) didn't convert, he assigned the profile (in a goofy way using the Display Control Panel) which is just dead wrong. Had he converted, no issue. The guy is very, very confused about color management!

So to counter this flat earth theory, I created this video:

The benefits of wide gamut working spaces on printed output:

This three part, 32 minute video covers why a wide gamut RGB working space like ProPhoto RGB can produce superior quality output to print.

Part 1 discusses how the supplied Gamut Test File was created and shows two prints output to an Epson 3880 using ProPhoto RGB and sRGB, how the deficiencies of sRGB gamut affects final output quality. Part 1 discusses what to look for on your own prints in terms of better color output. It also covers Photoshop’s Assign Profile command and how wide gamut spaces mishandled produce dull or over saturated colors due to user error.

Part 2 goes into detail about how to print two versions of the properly converted Gamut Test File file in Photoshop using Photoshop’s Print command to correctly setup the test files for output. It covers the Convert to Profile command for preparing test files for output to a lab.

Part 3 goes into color theory and illustrates why a wide gamut space produces not only move vibrant and saturated color but detail and color separation compared to a small gamut working space like sRGB.

High Resolution Video: http://digitaldog.net/files/WideGamutPrintVideo.mov

Low Resolution (YouTube):

--
Andrew Rodney
Author: Color Management for Photographers
The Digital Dog
 
I thought that bilinear interpolation was a complete description of the algorithm. Boy was I wrong.

To wit:

9ba2324b6dd843888a337071d27628d8.jpg.png

Details here:


Jim

--
 
Sorry if this is a stupid question, but I'm not an image processing person. I can see how bilinear interpolation works in the obvious way for up-sampling, but if you are down-sampling, don't you have to pre-filter then interpolate (or else you get aliasing)?

J.
 
Highly interesting.

1. Perhaps more could be learned by feeding the scalers appropriately chosen input (e.g. single-pixel cross-hatch patterns) at a sufficiently diverse pixel offsets so as to sample the phases of the applied filtering. (impulse response estimation, assuming 2d seperability).

I remember a discussion with mr Roubidoux where he told that Image Magick applies a (in my view sensible) modification of bilinear filtering. Instead of seeing it as a kind of "alpha-blending" between 4 neighboring pixels, it is (in my recollection) rather seen as particular samples of a 2-d triangular prototype filter.

For upsampling this turns out to be the same as the classical definition of bilinear filtering, while for downsampling it has the effect of widening the kernel (thus taking more samples into account) while still being approximations to the continous triangular function frequency response (sinc squared in the frequency domain).

2. You might also look into the choice of input/output grid. The same prototype filter might be employed in a 1:2 upscale either centering pixels alternatively "at" or "in-between" pixels, or at some offset (e.g. -0.25, +0.25)

using a "phase shift" of e.g. 1/2 pixel to produce different results in some cases. Both might be equally "right" yet look differently.

3. Scaling by small integer ratios will "sample" the filter differently than larger fractional ratios. Depending on if pixel centers or pixel borders are used as reference (if the designer allows a 1/2 pixel loss of information or not), 100x100 to 50x50 may be a clean 2:1 ratio, or 100x100 to 49x49 might be.

-h
 
Last edited:
I can see how bilinear interpolation works in the obvious way for up-sampling, but if you are down-sampling, don't you have to pre-filter then interpolate (or else you get aliasing)?
Yes, indeed, at least as I understand it, although the situation is a little murky in my mind for magnifications slightly below unity. I think this is Ps saving us from ourselves.

There's precedent for that. If you convert an image from sRGB to ProPhotoRGB in Ps, and select "Absolute Colorimetric" as your rendering intent, Ps will figure that you couldn't possibly have meant that, and will perform white point adaptation, so your neutral colors don't end up looking blueish.

Jim
 
1. Perhaps more could be learned by feeding the scalers appropriately chosen input (e.g. single-pixel cross-hatch patterns) at a sufficiently diverse pixel offsets so as to sample the phases of the applied filtering. (impulse response estimation, assuming 2d seperability).

I remember a discussion with mr Roubidoux where he told that Image Magick applies a (in my view sensible) modification of bilinear filtering. Instead of seeing it as a kind of "alpha-blending" between 4 neighboring pixels, it is (in my recollection) rather seen as particular samples of a 2-d triangular prototype filter.

For upsampling this turns out to be the same as the classical definition of bilinear filtering, while for downsampling it has the effect of widening the kernel (thus taking more samples into account) while still being approximations to the continous triangular function frequency response (sinc squared in the frequency domain).

2. You might also look into the choice of input/output grid. The same prototype filter might be employed in a 1:2 upscale either centering pixels alternatively "at" or "in-between" pixels, or at some offset (e.g. -0.25, +0.25)

using a "phase shift" of e.g. 1/2 pixel to produce different results in some cases. Both might be equally "right" yet look differently.

3. Scaling by small integer ratios will "sample" the filter differently than larger fractional ratios. Depending on if pixel centers or pixel borders are used as reference (if the designer allows a 1/2 pixel loss of information or not), 100x100 to 50x50 may be a clean 2:1 ratio, or 100x100 to 49x49 might be.
All good points. Thank you. I'm hoping that I won't have to reverse engineer the Ps algorithm myself, and that somebody knows how it works. Then all I'll have to do is check their work.

Jim
 
c3214ec417f84f7e8ccc221fd7fad52f.jpg.png

Not too far off the ideal. The Ps algorithm achieves that at the expense of high spatial frequency attenuation (and boost, a little lower).

Details here:


Jim

--
 

Keyboard shortcuts

Back
Top