Cosine-sum filters for resampling are filters that are designed as a sum of cosine functions, which is then truncated to a desired width.
An example formula for width-4 (range from -2 to 2) cosine-sum filters would be:
a+b×cos(90°×input)+c×cos(180°×input)+d×cos(270°×input)+e×cos(450°×input)+f×cos(540°×input)+g×cos(630°×input)+...
Omitting 360°, 720°, etc. because they don't produce a constant when tiled indefinitely. For width-6 filters use multiples of 60° instead of 90°.
Those parameters look like some sort of digitization of the Gaussian function: the digital Gaussian is a=0.25, b=0.375, c=0.15, d=0.025.
Those parameters produce a cardinal function (assuming "tensor" resampling) with the first derivative of points at -1 and 1 being set to 0.5 and -0.5 respectively: a=0.25, b=0.45458, c=0.25, d=0.045423
Are such filters already known and researched in the community?
Cosine-sum filters for resampling
-
- Posts: 8
- Joined: 2019-08-27T21:27:33-07:00
- Authentication code: 1152
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Cosine-sum filters for resampling
I have not heard of anything like that for resampling. Can you point to some reference?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Cosine-sum filters for resampling
IM has "-filter Cosine" for resampling. I don't know if this is the same as the OP.
snibgo's IM pages: im.snibgo.com
-
- Posts: 8
- Joined: 2019-08-27T21:27:33-07:00
- Authentication code: 1152
Re: Cosine-sum filters for resampling
"-filter Cosine" is using a Cosine window (made with a cosine function) to window the Sinc function to produce the filter. Cosine-sum filters are made by adding cosine functions to produce the filter. Those are not the same.
There are some window functions like Hann, Hamming and Blackman that have a cosine-sum structure. The same concept could be used for resampling filters.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Cosine-sum filters for resampling
Yes, but can you point to some reference so that we can see what is being done or is this just some idea of yours with no current background or theory?
-
- Posts: 8
- Joined: 2019-08-27T21:27:33-07:00
- Authentication code: 1152
Re: Cosine-sum filters for resampling
This page demonstrates various window functions of the cosine-sum structure: https://en.wikipedia.org/wiki/Window_fu ... um_windows
As for the use of the cosine-sum structure for resampling filters, this is indeed "with no current background or theory".
Re: Cosine-sum filters for resampling
We do include a Hann filter, a member of the cosine-sum family, however we do not currently support the generalized cosine window case. You are welcome to contribute a cosine-sum filter. Look for FilterFunctions in MagickCore/resize.c to get started.
-
- Posts: 8
- Joined: 2019-08-27T21:27:33-07:00
- Authentication code: 1152
Re: Cosine-sum filters for resampling
It would be interesting to research and find out if cosine-sum filters (whether "tensor" or "EWA") are any better than windowed Sinc filters and cubic filters.