As a result of some testing using windowed jinc on deblur it appears that there is not one "best" choice , indeed windowing is not always advantageous.
As I said elsewhere I think some more thought needs to go into why the window is there and what it is supposed to achieve rather than subjective empirical testing on a perhaps rather ill-defined group of test images.
My understanding of windowing from my work on using Lanczos for bidirectional scaling interpolation in GIMP is that the aim is to prevent a sharp truncation of the filter function at the end of the kernel window. Such an abrupt change at an arbitrary point in the function can be detrimental, so one objective is to ensure the function is tapered to zero before the edge of the kernel window. When the convolution is done by TD multiplication rather than FFT, the kernel is typically quite small and this is important.
Another choice made by Lanczos was to make the window cut-off (outside first lobe) coincide with a zero point in the base function. While this seems like a nice idea I have not looked into the mathematical justification for this choice. I bow to Lanczos' far superior rigour and intellect and assume he based this choice on sound reasoning.
I experimented with L4 in that context but the ringing on block graphics became far too pronounced. This brings in the second reason for windowing: in deviating from the idea form of the base function a distortion is introduced , this results is a slight softening blur. This will typically reduce the extent to which the ringing is visible. It does this by reducing the higher frequencies that are necessary for a sharp step function in the frequency domain: the ideal step filter that is the original aim.
In reducing sharpness of the filter transition the overshoot and subsequent ringing in FD that causes ghosting in the image is reduced.
I suspect there is another cause of ringing but the gentle softening , while being technical a degradation, often produces a better compromise result. There is a clear trade off here. The optimum method will almost certainly depend upon the subject material: an photo, even a portrait, will accept ringing better than block graphic art or lettering.
In experimenting with adding a window fn to Fred's cameradeblur I initially scaled a sinc lobe at 3x the jinc (not knowing the proper location of the jinc zero at 3.2383). On the classic "camerman" greyscale test image with an artificial 15px defocus blur this gave a small but worthwhile improvement.
Code: Select all
cameraman.png: PNG image data, 256 x 256, 8-bit grayscale, non-interlaced
On another image, a scan from a traditional negative film image, (ie true defocus blur) I found the best deblur result from pure jinc without a window. ( 36 px deblur ). Though the script is still producing such pronounced ringing that it is of little use for aesthetic images.
Code: Select all
cygale.png: PNG image data, 524 x 524, 8-bit/color RGBA, non-interlaced
The ensuing filter in the latter case has six jinc rings filling about half the filter window, the seventh is barely visible. In this case it appears that distorting the idea function with a window is detrimental since the jinc is fully expressed within the window (thought you need to look damn close to see any difference).
I expect this will mean that in the case of EWA the choice will depend on the scaling factor which determines the proportions of the ensuing jinc filter. Maybe some evaluation of the amount of power in the outer rings and the signal power of the difference between windowed and unwindowed over the fitler dimensions would allow an objective criterion for whether to apply a window.
Since it is the central lobe that does most of the work, the outer rings being progressively finer corrections, I would favour sinc over jinc as window fn. The jinc having a much faster decay envelop will probably degrade the essential central lobe more than sinc. I would suggest that the broader sinc lobe would generally be less destructive (in the sense of blurring the result) than a jinc window.
Of course there will be some test cases where this blurring may give a more pleasing result by, for example, softening staircasing on near horizontal lines. So some care needs to be taken in the choice of test image and the appreciation given to such features.