Page 2 of 2

Re: Recommended Kaiser alpha values for windowed Sinc resamp

Posted: 2012-05-10T18:35:42-07:00
by anthony
NicolasRobidoux wrote:@Anthony: If I understand correctly, what you are talking about is "exact area filtering".
...
Yes, I know I'm simplifying, and not quite dealing with the precise question. But my opinion is that this direction (exact area methods) is a back back back back burner.
yes the discrete sampling only seemed to be important when sigma became very small, and in resampling you do not get sigma smaller that 1/2. I don't think it is worth the effort.

It isn't even used a lot with convolve kernel generation! Though the kernel generator for 1-D Gaussian does make some effort. It takes 3 'samples' of the function to generate the discrete value for the kernel. Comments say this was 'how photoshop did it'. Still it causes major headaches and worries when I was creating Named Kernels. It is not done for 2-d Gaussian, DoG or the closely related LoG kernels.

Re: Recommended Kaiser alpha values for windowed Sinc resamp

Posted: 2012-05-10T18:42:21-07:00
by NicolasRobidoux

Re: Recommended Kaiser alpha values for windowed Sinc resamp

Posted: 2012-05-10T18:50:44-07:00
by NicolasRobidoux
anthony wrote:...It takes 3 'samples' of the function to generate the discrete value for the kernel. Comments say this was 'how photoshop did it'. Still it causes major headaches and worries when I was creating Named Kernels. It is not done for 2-d Gaussian, DoG or the closely related LoG kernels.
Exact area anything is generally a pain in the neck: To do things right you need to use antiderivatives, making sure not to be bitten by round off when you subtract values at nearby points, or high accuracy quadratures.
I'm not saying it's impossible. Just something I'd only be willing to fix if something's really broken, because unless you're careful, you'll just make things worse than just pretending that the local integral is proportional to the point value at the center (a low accuracy quadrature, as it were).
I believe that there used to be a minor industry computing high accuracy approximations of gaussian blur with specific stencils and sigma, roughly equivalent to computing quadratures with Gaussian density functions ("measures").
I certainly don't want to go there now.

Re: Recommended Kaiser alpha values for windowed Sinc resamp

Posted: 2012-05-10T18:55:14-07:00
by fmw42
NicolasRobidoux wrote: Exact area anything is generally a pain in the neck: To do things right you need to use antiderivatives ...
Curious use of antiderivative rather than (indefinite) integral (integration)! Why?

Re: Recommended Kaiser alpha values for windowed Sinc resamp

Posted: 2012-05-10T19:00:46-07:00
by anthony
NicolasRobidoux wrote:I_0 = 1 (see http://www.efunda.com/math/bessel/besselIKPlot.cfm.)

Okay -- removing normalization factor from Kaiser. --- Put Back again Kaiser as x=0 returns a value of 106!!!
The multiplier is not a normalization but a make zero value = 1.0 which is a more desirable result for a filter

What about the Psuedo-Code... Do I have it correct?
If so I'll implement it.

Re: Recommended Kaiser alpha values for windowed Sinc resamp

Posted: 2012-05-10T19:01:01-07:00
by NicolasRobidoux
fmw42 wrote:
NicolasRobidoux wrote: Exact area anything is generally a pain in the neck: To do things right you need to use antiderivatives ...
Curious use of antiderivative rather than (indefinite) integral (integration)! Why?
I'm not sure I understand the question: The two terms are informally considered to be synonyms: http://en.wikipedia.org/wiki/Antiderivative.
In practice, if you don't use quadratures, you'll find the integrals over short intervals or squares by evaluating antiderivatives. (Yes, I know there are complications if the integrand is a piecewise function, or is not continuous.)

Re: Recommended Kaiser alpha values for windowed Sinc resamp

Posted: 2012-05-10T19:31:24-07:00
by fmw42
Just curious why you used antiderivative rather than integral. I know they are synonymous. But I rarely hear the use of antiderivative. Is that a Canadian or mathematician thing?

Re: Recommended Kaiser alpha values for windowed Sinc resamp

Posted: 2012-05-11T03:54:48-07:00
by NicolasRobidoux
@Fred: I think (they're in boxes right now) that recent Calculus textbooks use both terms to emphasize the "unexpected" fact that antiderivatives allow one to compute indefinite and definite integrals (a.k.a. Fundamental Theorem of Calculus). Conceptually, antiderivatives are different than indefinite integrals. The "miracle" is that they are twins. It's a pedagogical thing: the word "antiderivative" helps students remember what they have to do: "undo differentiation". This being said, I taught with a Canadian textbook (popular in the US and somewhat popular in French speaking Europe, I believe), Stewart's.

Re: Recommended Kaiser alpha values for windowed Sinc resamp

Posted: 2012-05-11T09:25:12-07:00
by fmw42
It has certainly been a long time since I took calculus. I guess terminology changes. Of course I had learned of antiderivative, but we mostly used integral back then. In most of my physics classes (undergrad and grad), the term antiderivative was hardly used in favor of integral.

Any way, it was just a curiosity question.

Thanks.

Fred

Re: Recommended Kaiser alpha values for windowed Sinc resamp

Posted: 2012-05-11T09:46:12-07:00
by NicolasRobidoux
anthony wrote:
NicolasRobidoux wrote:I_0 = 1 (see http://www.efunda.com/math/bessel/besselIKPlot.cfm.)

Okay -- removing normalization factor from Kaiser. --- Put Back again Kaiser at x=0 returns a value of 106!!!
The multiplier is not a normalization but a make zero value = 1.0 which is a more desirable result for a filter

What about the Psuedo-Code... Do I have it correct?
If so I'll implement it.
Your pseudo-code is correct.
But I suck! Kaiser at zero is not I_0 at zero, it's I_0 at beta, which the plot makes clear runs away from 1 pretty fast. If you want plots that go through 1 at x=0, you need the normalization, which you had just right.

Re: Recommended Kaiser alpha values for windowed Sinc resamp

Posted: 2012-05-13T17:34:46-07:00
by anthony
NicolasRobidoux wrote:
anthony wrote: Is this Pseudo-code correct?

Code: Select all

    beta=6.5
    if "filter:beta" then  beta=value
    if "filter:alpha" then  beta=value*PI
    normalization=1/IO(beta)
Then Kaiser formula as before. but using beta instead of alpha

Code: Select all

   normalization   *   IO(beta*sqrt(1.0-x*x))
Yes, this is correct. But please send me an email when you make that change, because then I'll need to change immediately what Adam runs (since right now we use an alpha value which should be set as a beta value once you've change this bit of the API).
Rather than remove 'filter:alpha' I'll add filter:kaiser-alpha and filter:kaiser-beta with filter:alpha mapping to (but not overriding if set) filter:kaiser-beta. that way he will not be effected, and the expert settings are more definitive.

Later I can remove filter:alpha.


DONE - comitted into SVN. values are set in the order
default 6.5
"filter:alpha"
"filter:kaiser-beta"
"filter:kaiser-alpha" * PI
the latter overriding the former. (unless you declare 'beta' should override 'alpha' :-)
NOTE: "filter:alpha" is to be depreciated in IMv7 at a later date.