Page 3 of 3

Re: BC-splines with 2C+B=1 are optimal for EWA resampling

Posted: 2012-04-23T06:55:18-07:00
by NicolasRobidoux
Now that RobidouxSharp is an official IM method, here is the key data for this Keys cubic (I probably should have cleaned this up earlier; ah well). Whenever possible, I use an expression which is less prone to round off (sum of positive numbers instead of mixed sign sums).

Code: Select all

C = 7/(2+12*sqrt(2)) = 0.3689927438004929
B = 6/(13+7*sqrt(2)) = 0.2620145123990142
first zero crossing = (45+14*sqrt(2))/(19+28*sqrt(2)) = 1.1058229337190195

Re: BC-splines with 2C+B=1 are optimal for EWA resampling

Posted: 2012-04-23T07:04:51-07:00
by NicolasRobidoux
While I'm at it, I may as well do the same for the Robidoux Keys cubic:

Code: Select all

C = 113/(58+216*sqrt(2)) = 0.31089212245300067
B = 12/(19+9*sqrt(2)) = 0.37821575509399866
first zero crossing = (123+36*sqrt(2))/(47+72*sqrt(2)) = 1.1685777620836932

Re: BC-splines with 2C+B=1 are optimal for EWA resampling

Posted: 2012-04-23T07:09:03-07:00
by NicolasRobidoux
I also made sure that the B+2C=1 with the truncated values. This only affects the 17th digit. Irrelevant.

Re: BC-splines with 2C+B=1 are optimal for EWA resampling

Posted: 2014-04-02T14:30:10-07:00
by NicolasRobidoux
NicolasRobidoux wrote:The above RobidouxSharp comes from minimizing the worst case deviation from the original value when the original value is one of the two extremes (0 and 255 in typical 8 bit).

An alternate way is to minimize the worst case deviation when the original value is the average of the largest and smallest possible values (for example, 127.5 in typical 8 bit). I will give this a try later.

It would not surprise me if this one lands almost on top of Mitchell-Netravali.

P.S. It's not. I should have remembered that minimizing the L^1 norm generally gives sparsity, and indeed the minimizer is the Keys cubic which is equal to 0 at sqrt(2):
B = (9-3*sqrt(2))/7 = 0.67962275898295921
and
C = 0.1601886205085204
which, in principle, should be quite blurry.

P.S. 2... and indeed it is pleasant, and very blurry:

Code: Select all

convert rose: -define filter:c=.1601886205085204 -filter Cubic -distort Resize 3000% rose_RobidouxSoft.png
If it's OK, I would like to add this one as a named filter, under the name "RobidouxSoft".
There is starting to be quite a bit of evidence that Keys cubics work well with EWA, and although the Robidoux cubic is great for downsampling, it is found to be a bit "too sharp" when upsampling. I am not the only one who has noticed that:
http://www.luminous-landscape.com/forum ... #msg624780
http://www.luminous-landscape.com/forum ... #msg722531

P.S. I think that this filter may work well enlarging through linear light, say

Code: Select all

convert rose: -colorspace XYZ -define filter:c=.1601886205085204 -filter Cubic -distort Resize 3000% -colorspace sRGB rose_RobidouxSoft.png
When I have a minute, I'll check.

Re: BC-splines with 2C+B=1 are optimal for EWA resampling

Posted: 2014-04-02T17:43:15-07:00
by magick
Ok.

Re: BC-splines with 2C+B=1 are optimal for EWA resampling

Posted: 2014-06-08T11:45:49-07:00
by fmw42
I do not see RobidouxSoft listed when I do the following. Was it actually added, but just not listed?


convert -list filter

Code: Select all

Bartlett
Blackman
Bohman
Box
Catrom
Cosine
Cubic
Gaussian
Hamming
Hann
Hermite
Jinc
Kaiser
Lagrange
Lanczos
Lanczos2
Lanczos2Sharp
LanczosRadius
LanczosSharp
Mitchell
Parzen
Point
Quadratic
Robidoux
RobidouxSharp
Sinc
SincFast
Spline
Triangle
Welch

Re: BC-splines with 2C+B=1 are optimal for EWA resampling

Posted: 2014-06-08T11:52:26-07:00
by NicolasRobidoux
Fred: I said I would add it, but have not done it yet. May take me a while.
I got the OK from magick to add RobidouxSoft and LanczosSharpest.

Re: BC-splines with 2C+B=1 are optimal for EWA resampling

Posted: 2014-06-08T11:57:08-07:00
by fmw42
NicolasRobidoux wrote:Fred: I said I would add it, but have not done it yet. May take me a while.
I got the OK from magick to add RobidouxSoft and LanczosSharpest.

Sorry, I misread the post. I though Magick was saying OK that he would add it. My mistake. No hurry. Just curious.

Re: BC-splines with 2C+B=1 are optimal for EWA resampling

Posted: 2014-06-24T23:22:08-07:00
by NicolasRobidoux
Fred (and henrywho?):
If I remember correctly, you are among some (?) who liked EWA Catmull-Rom.
After years of finding this stance somewhat strange, I am finally seeing situations in which such a brutally sharp Keys EWA may be useful. I am actually considering values of Keys alpha = BC-spline C even larger than .5.
Goes to show...
For now, I am sticking to "use a Keys when doing EWA with a BC-spline" as a rule of thumb (this of course is the point of this thread), but I am not 100% sure of that anymore.
The result has a reasonable theoretical basis. But reality is often more complicated than theory.

Re: BC-splines with 2C+B=1 are optimal for EWA resampling

Posted: 2014-06-25T10:40:38-07:00
by fmw42
Yes, I generally like the sharpness from the Catrom (keys cubic convolution) or Lagrange and can usually live with the other artifacts. Of course there are cases where Moire is very bad and I would then use other filters. However, I generally just use the defaults as reasonable compromises. If I were a professional photographer, I would likely be more critical.

Re: BC-splines with 2C+B=1 are optimal for EWA resampling

Posted: 2014-07-17T21:04:05-07:00
by henrywho
Yes, I always tell my friends to use linear light downsizing with EWA Catrom or Lagrange, while they keep using USM to (/hoping to) recover the highlight lost after downsizing in sRGB. EWA Catrom is an overkill in most cases, though.

Re: BC-splines with 2C+B=1 are optimal for EWA resampling

Posted: 2014-07-25T06:29:39-07:00
by NicolasRobidoux