proper scaling of the Jinc filter for EWA use
Posted: 2011-10-14T08:04:36-07:00
I'm (still) thinking about how to improve EWA filtering. I don't find any of the available filters completely satisfactory yet.
There are two issues that I'd like to understand better w.r.t. the Jinc filter, and which I can't settle with a quick and dirty literature search:
1) What is the best "blur", that is, if what should the scaling of the Jinc filter be. Unlike for the sinc function, for which obviously one wants the cardinal function to have a zero at every image grid location, the issue of scaling of the JInc function is not completely clear, given that it is impossible to align more than one of its zeros with the pixel grid. More or less, it's been assumed by everyone that the starting point is blur=1, and indeed this works pretty well, although it's pretty blurry. But I'm really not sure it's right.
2) What is the best windowing function? It's been assumed (e.g. Gustafsson's Interactive Image Warping) that just like Lanczos is Sinc-windowed Sinc, the right thing to do is to window Jinc with itself. One consequence is that the EWA Lanczos kernel decays very fast away from its center, which prevents the use of small blur because you need to give it some spread to prevent "nearest neighbour type" behavior. For example, it would appear to me that Jinc would be better windowed with J_0, although my argument for this is really wishy washy.
Questions:
A)
Does anybody know right off the bat what the frequency response cutoff of the standard Jinc filter, that is, J_1(pi r)/r, is?
I don't see in the easily found literature a statement telling me whether it's 1 or 2/sqrt(2) = sqrt(2)---either value would make sense. (The frequency response plot in Gustafsson is not produced so it's easy to read. It looks like sqrt(2) to me, and the text before figure 5 of his Masters thesis suggests it probably is. However, he uses J_1(2 pi r)/r, which is different than what is apparently in resize.c.)
P.S.: The answer is here: http://books.google.ca/books?id=w3BpSIx ... ff&f=false. I'm also getting my hands on Pratt's book, which is references in the resize.c code.
P.S. II The last inequality on page 96 of Pratt's book makes it clear that the critical w_0 is sqrt(2) pi. Resize.c uses pi (one times pi, if you will, instead of sqrt(2) times pi). So, my hunch was right that the currently used default Jinc is almost certainly needlessly blurry, statement which should not surprise too many people. When I have time, I'll look at the windowing issue.
B)
It would appear to me that the cutoff frequency of the unwindowed Jinc filter should be adjusted (with blur) so it is 2/sqrt(2) if it's not already. The reason is that this is the highest frequency that can be found in an image (it is obtained by alternating black and white diagonals). So, if the answer to A) is 1 instead of sqrt(2), this gives some motivation to making the blur smaller, which should lead to a less blurry scheme.
C)
However, making the blur smaller with Jinc-windowed Jinc leads to jaggies galore. So: Does anybody know anything solid about what the windowing function should be? I'm hoping that the "right" windowing will help with aliasing if blur is set to 1/sqrt(2), and with blurriness otherwise.
When I have time (not for a while), I'll do a more in-depth literature search. And I may start experimenting.
There are two issues that I'd like to understand better w.r.t. the Jinc filter, and which I can't settle with a quick and dirty literature search:
1) What is the best "blur", that is, if what should the scaling of the Jinc filter be. Unlike for the sinc function, for which obviously one wants the cardinal function to have a zero at every image grid location, the issue of scaling of the JInc function is not completely clear, given that it is impossible to align more than one of its zeros with the pixel grid. More or less, it's been assumed by everyone that the starting point is blur=1, and indeed this works pretty well, although it's pretty blurry. But I'm really not sure it's right.
2) What is the best windowing function? It's been assumed (e.g. Gustafsson's Interactive Image Warping) that just like Lanczos is Sinc-windowed Sinc, the right thing to do is to window Jinc with itself. One consequence is that the EWA Lanczos kernel decays very fast away from its center, which prevents the use of small blur because you need to give it some spread to prevent "nearest neighbour type" behavior. For example, it would appear to me that Jinc would be better windowed with J_0, although my argument for this is really wishy washy.
Questions:
A)
Does anybody know right off the bat what the frequency response cutoff of the standard Jinc filter, that is, J_1(pi r)/r, is?
I don't see in the easily found literature a statement telling me whether it's 1 or 2/sqrt(2) = sqrt(2)---either value would make sense. (The frequency response plot in Gustafsson is not produced so it's easy to read. It looks like sqrt(2) to me, and the text before figure 5 of his Masters thesis suggests it probably is. However, he uses J_1(2 pi r)/r, which is different than what is apparently in resize.c.)
P.S.: The answer is here: http://books.google.ca/books?id=w3BpSIx ... ff&f=false. I'm also getting my hands on Pratt's book, which is references in the resize.c code.
P.S. II The last inequality on page 96 of Pratt's book makes it clear that the critical w_0 is sqrt(2) pi. Resize.c uses pi (one times pi, if you will, instead of sqrt(2) times pi). So, my hunch was right that the currently used default Jinc is almost certainly needlessly blurry, statement which should not surprise too many people. When I have time, I'll look at the windowing issue.
B)
It would appear to me that the cutoff frequency of the unwindowed Jinc filter should be adjusted (with blur) so it is 2/sqrt(2) if it's not already. The reason is that this is the highest frequency that can be found in an image (it is obtained by alternating black and white diagonals). So, if the answer to A) is 1 instead of sqrt(2), this gives some motivation to making the blur smaller, which should lead to a less blurry scheme.
C)
However, making the blur smaller with Jinc-windowed Jinc leads to jaggies galore. So: Does anybody know anything solid about what the windowing function should be? I'm hoping that the "right" windowing will help with aliasing if blur is set to 1/sqrt(2), and with blurriness otherwise.
When I have time (not for a while), I'll do a more in-depth literature search. And I may start experimenting.