Page 3 of 4
Re: High tap count Spline filters? (Spline36/64/100/144/196/256)
Posted: 2017-08-15T15:07:16-07:00
by Akira
We probably cannot change the name of the existing B-spline filter (spline), unfortunately since it would break existing code that people might have developed for it. So we will have to go with either spline16 spline36 spline64 or splinelobes, unless you can think of a better name for the latter.
Yes, I understand that.
Do think higher orders are necessary or make that much more difference?
(I guess) as nobody would use higher order lanczos, we wouldn't need higher order ones.
Can you provide tests against the "NASA" image you mentioned?
Okay! (though I'm not sure they make a noticeable difference)
Re: High tap count Spline filters? (Spline36/64/100/144/196/256)
Posted: 2017-08-15T15:11:51-07:00
by fmw42
Okay! (though I'm not sure they make a noticeable difference)
I only asked since you said earlier "the only important thing is the NASA image"? If you do not feel it is a better test, then it is OK to skip. Do you have a reference to that image and any tests done with it with respect to this new filter?
Can you help with the code as per
posting.php?mode=reply&f=2&t=32506#pr148830
Do you like the name -splinelobes or -cubicspline better?
Re: High tap count Spline filters? (Spline36/64/100/144/196/256)
Posted: 2017-08-15T15:24:58-07:00
by fmw42
I ran these tests and do not see any visual difference, except with catrom and the others. I do not see any difference between spline16 and spline64, nor between spline64 and lanczos.
magick logo128.png -colorspace RGB -define filter:lobes=16 -filter splinelobes -resize 400% -colorspace sRGB logo128_spline16.png
magick logo128.png -colorspace RGB -define filter:lobes=36 -filter splinelobes -resize 400% -colorspace sRGB logo128_spline36.png
magick logo128.png -colorspace RGB -define filter:lobes=64 -filter splinelobes -resize 400% -colorspace sRGB logo128_spline64.png
magick logo128.png -colorspace RGB -filter lanczos -resize 400% -colorspace sRGB logo128_lanczos.png
magick logo128.png -colorspace RGB -filter catrom -resize 400% -colorspace sRGB logo128_catrom.png
Code: Select all
magick compare -metric rmse logo128_lanczos.png logo128_spline16.png null:
628.19 (0.00958556)
magick compare -metric rmse logo128_lanczos.png logo128_spline36.png null:
628.19 (0.00958556)
magick compare -metric rmse logo128_lanczos.png logo128_spline64.png null:
628.19 (0.00958556)
These results are identical. The verbose information says we have different filters, but each successive ones have more and more zero values at the end of the list. So it looks like it is just spline16 padded out with zeroes. Is this a bug?
Re: High tap count Spline filters? (Spline36/64/100/144/196/256)
Posted: 2017-08-15T15:30:21-07:00
by Akira
I only asked since you said earlier "the only important thing is the NASA image"? If you do not feel it is a better test, then it is OK to skip. Do you have a reference to that image and any tests done with it with respect to this new filter?
I referred it because you'll get the correct image only when resize it in the linear space. I'll test it and share the pictures anyway.
Can you help with the code as per posting.php?mode=reply&f=2&t=32506#pr148830
I've already tried it and what I got is:
magick: unrecognized image filter '-filter' 'spline-lobes' at CLI arg 6 @ error/operation.c/CLISettingOptionInfo/880.
I'll try building it from the GitHub-Master source.
Do you like the name -splinelobes or -cubicspline better?
I prefer CubicSpline better.
Re: High tap count Spline filters? (Spline36/64/100/144/196/256)
Posted: 2017-08-15T15:40:00-07:00
by magick
Its not -define filter:lobes={16,36,64}. Instead its -define filter:lobes={2,3,4}. We prefer one name, CubicSpline, because we might add support for lobes 5, 6, 7, etc. in the future.
Re: High tap count Spline filters? (Spline36/64/100/144/196/256)
Posted: 2017-08-15T15:45:28-07:00
by fmw42
The integers, n, are not the number of lobes as I understand the link. The number of lobes is (2n)^2, so for n=2, you get 4^2=16, for n=3, you get 6^2=36, and for n=4, you get 8^2=64. If you want to use n rather than number of lobes, then that is fine. But is it consistent with Anthonys -define filter:lobes=X? I have not tried his define before with lanczos or any other filter. So I just want to be sure we are on the same wavelength. Perhaps the OP can correct me if I am wrong about the relationship of n and number of lobes.
But if one uses the wrong value for -define filter:lobes=X, then should one not have some traps to report inconsistent values?
Re: High tap count Spline filters? (Spline36/64/100/144/196/256)
Posted: 2017-08-15T15:51:27-07:00
by magick
Here's the latest: Use -define filter:support={2,3,4} to specify the support size for filtering for the CubicSpline filter.
Re: High tap count Spline filters? (Spline36/64/100/144/196/256)
Posted: 2017-08-15T15:53:36-07:00
by fmw42
From the reference, it says
"Spline (2n) 2 Resize refers to n pixels around the point you want to interpolate."
So to me that means that spline 16, should have only 16 points in each dimension evaluates. That sounds more like taps. I do not know how many lobes that corresponds to unless it is graphed with the correct number of values. It does not seem to be lobes, if I have interpreted this correctly.
Re: High tap count Spline filters? (Spline36/64/100/144/196/256)
Posted: 2017-08-15T15:57:15-07:00
by Akira
fmw42 wrote: ↑2017-08-15T15:45:28-07:00But is it consistent with Anthonys -define filter:lobes=X?
Yes, if you believe me... (2n)^2.
Re: High tap count Spline filters? (Spline36/64/100/144/196/256)
Posted: 2017-08-15T15:57:23-07:00
by fmw42
Anthony already has defines that include the name "support", which means something different.
A 12 lobed 'Lanczos' windowed filter clipped to just the first 8 lobes of the resulting windowed filter...
-filter Lanczos
-define filter:win-support=12
-define filter:support=8
This makes it about four times faster, by ignoring (support clipping at
the window-modulated 'tail' (to 12) of the resulting windowed-sinc filter. This however may result in some extra but minor artefacts as a result of the support clipping.
Using Gaussian to 'blur' an image! This is equivalent to a -gaussian 5x2 operation, but by using a no-op distort!
-filter Gaussian
-define filter:sigma=2
-define filter:support=5
-distort SRT 0
If we can confirm my comments above, then it would be better to use -define filter:taps or -define filter:cubicspline:taps. Be this needs to be confirmed.
Re: High tap count Spline filters? (Spline36/64/100/144/196/256)
Posted: 2017-08-15T15:58:37-07:00
by fmw42
Akira wrote: ↑2017-08-15T15:57:15-07:00
fmw42 wrote: ↑2017-08-15T15:45:28-07:00But is it consistent with Anthonys -define filter:lobes=X?
Yes, if you believe me... (2n)^2.
Please clarify. Is (2n)^2 the number of lobes are the number of values to evaluate in the filter (i.e. taps, according to the other reference I found)?
Re: High tap count Spline filters? (Spline36/64/100/144/196/256)
Posted: 2017-08-15T16:01:00-07:00
by fmw42
From the reference, "Spline (2n) 2 Resize refers to n pixels around the point you want to interpolate."
If you have 16 pixels in each dimension that would be 16x16=256 values. I am not sure when you report the verbose information on the filter is that 1D or 2D?
Magick, the number of values you evaluated in in spline16 was 202. So that does not seem to correspond to (2n)^2 values.
Re: High tap count Spline filters? (Spline36/64/100/144/196/256)
Posted: 2017-08-15T16:01:33-07:00
by magick
Spline 16 has a support size of 2, spline 36 is 3, and spline 64 is 4. You set the support size with the filter:support size.
Re: High tap count Spline filters? (Spline36/64/100/144/196/256)
Posted: 2017-08-15T16:03:31-07:00
by Akira
Lanczos 2,3,4 [lobes] = Lanczos 16,36,64 [reference samples]
Re: High tap count Spline filters? (Spline36/64/100/144/196/256)
Posted: 2017-08-15T16:04:07-07:00
by fmw42
magick wrote: ↑2017-08-15T16:01:33-07:00
Spline 16 has a support size of 2, spline 36 is 3, and spline 64 is 4. You set the support size with the
filter:support size.
OK. That makes more sense. But for support 2=n, you should evaluate (2*n)^2 = 16 values (in one dimension?). But I got originally 202 values. Please clarify the correspondence.