possible bug in new fx function jinc IM 6.6.0-4
Posted: 2010-03-11T16:56:10-07:00
IM 6.6.0-4 Q16 Mac OSX Tiger
I am testing the new sinc and jinc fx functions.
The sinc seems to be working correctly (mathematically correct). It should have a central peak of amplitude 1 and a first negative peak of amplitude -0.21 (so that it ranges from -0.21 to 1)
convert -size 1x256 gradient: -rotate 90 -fx "sinc(u)" miff:- |\
im_profile - tmp_sinc_profile.gif
convert -size 1x256 gradient: -rotate 90 -fx "sinc(10*u)" miff:- |\
im_profile - tmp_sinc10_profile.gif
#scaled to 0 to 1 so no clipping
convert -size 1x256 gradient: -rotate 90 -fx "(sinc(10*u)+0.21)/1.21" miff:- |\
im_profile - tmp_sinc10a_profile.gif
The jinc does not come out mathematically according to one of two definitions that I have found.
The jinc function ranges from -0.06613 to 0.5. It can be computed as a series approximation to the Bessel function. The formula is obtained from The Handbook Of Mathematical Functions by Abramowitz and Stegun, formula 9.4.1 and 9.4.3, p369-370. I have scripted this successfully in my FFT work. See http://www.fmwconcepts.com/imagemagick/ ... properties
The other definition is basically to scale that by two so that it ranges from -0.1323 to 1 and can be found at http://books.google.com/books?id=d8FMlH ... on&f=false Scroll to the next page for a table of the peak amplitudes.
Testing the implemented jinc, I find that the main peak is at about 80% and so does not fit either of these two models. Perhaps you are using a different model. If so, could you provide me with the main peak amplitude and the first negative peak amplitude (or reference), so that I can do appropriate scaling.
Or (better) perhaps you might reformulate/normalize it so that the main peak is of amplitude of 1 so that it kind of parallels the sinc function in that regard.
convert -size 1x256 gradient: -rotate 90 -fx "jinc(u)" miff:- |\
im_profile - tmp_jinc_profile.gif
convert -size 1x256 gradient: -rotate 90 -fx "jinc(5*u)" miff:- |\
im_profile - tmp_jinc5_profile.gif
I am testing the new sinc and jinc fx functions.
The sinc seems to be working correctly (mathematically correct). It should have a central peak of amplitude 1 and a first negative peak of amplitude -0.21 (so that it ranges from -0.21 to 1)
convert -size 1x256 gradient: -rotate 90 -fx "sinc(u)" miff:- |\
im_profile - tmp_sinc_profile.gif
convert -size 1x256 gradient: -rotate 90 -fx "sinc(10*u)" miff:- |\
im_profile - tmp_sinc10_profile.gif
#scaled to 0 to 1 so no clipping
convert -size 1x256 gradient: -rotate 90 -fx "(sinc(10*u)+0.21)/1.21" miff:- |\
im_profile - tmp_sinc10a_profile.gif
The jinc does not come out mathematically according to one of two definitions that I have found.
The jinc function ranges from -0.06613 to 0.5. It can be computed as a series approximation to the Bessel function. The formula is obtained from The Handbook Of Mathematical Functions by Abramowitz and Stegun, formula 9.4.1 and 9.4.3, p369-370. I have scripted this successfully in my FFT work. See http://www.fmwconcepts.com/imagemagick/ ... properties
The other definition is basically to scale that by two so that it ranges from -0.1323 to 1 and can be found at http://books.google.com/books?id=d8FMlH ... on&f=false Scroll to the next page for a table of the peak amplitudes.
Testing the implemented jinc, I find that the main peak is at about 80% and so does not fit either of these two models. Perhaps you are using a different model. If so, could you provide me with the main peak amplitude and the first negative peak amplitude (or reference), so that I can do appropriate scaling.
Or (better) perhaps you might reformulate/normalize it so that the main peak is of amplitude of 1 so that it kind of parallels the sinc function in that regard.
convert -size 1x256 gradient: -rotate 90 -fx "jinc(u)" miff:- |\
im_profile - tmp_jinc_profile.gif
convert -size 1x256 gradient: -rotate 90 -fx "jinc(5*u)" miff:- |\
im_profile - tmp_jinc5_profile.gif