proper scaling of the Jinc filter for EWA use
-
- Posts: 1944
- Joined: 2010-08-28T11:16:00-07:00
- Authentication code: 8675308
- Location: Montreal, Canada
Re: proper scaling of the Jinc filter for EWA use
The neat thing is that making the EWA result of Lanczos what I called "EWA Jinc-windowed Jinc radius 3", the corresponding filter in the orthogonal world is the plain vanilla Sinc-windowed Sinc 3, given that the distance one should use in the orthogonal world is the box distance, w.r.t. which plain vanilla orthogonal Lanczos 3 is alread "radius 3".
Let's see how thing pan out, but in terms of user expectations, what -filter Lanczos -distort Resize (or any use of -distort) does may be better this "Jinc Lanczos radius 3" than the plain vanilla Jinc-windowed Jinc 3, which is much softer than is Sinc orthogonal cousin.
On the other hand, one would then be tempted to do the same with all the main orthogonal filters, which opens the door to figuring out what the matches are (we know EWA RobidouxSharp is a good match for orthogonal Catmull-Rom, for example, but there are quite a few "pairings" to set, and then the "-distort" name of a filter does not really reflect how it does, just what it does).
Let's see how thing pan out, but in terms of user expectations, what -filter Lanczos -distort Resize (or any use of -distort) does may be better this "Jinc Lanczos radius 3" than the plain vanilla Jinc-windowed Jinc 3, which is much softer than is Sinc orthogonal cousin.
On the other hand, one would then be tempted to do the same with all the main orthogonal filters, which opens the door to figuring out what the matches are (we know EWA RobidouxSharp is a good match for orthogonal Catmull-Rom, for example, but there are quite a few "pairings" to set, and then the "-distort" name of a filter does not really reflect how it does, just what it does).
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: proper scaling of the Jinc filter for EWA use
Do you think it may be (eventually) worth while to automatically make a filter for Jinc windowed Jinc (EWA Lanczo) , auto-scales so lobes == support. EG: 3 lobes windowed Jinc, scaled to have support 3?
If we do this, perhaps it will be time to give a specific name to this: scaled jinc windowed jinc for window use.
I am not suggesting we do this NOW, just talk about it for the moment.
If we do this, perhaps it will be time to give a specific name to this: scaled jinc windowed jinc for window use.
I am not suggesting we do this NOW, just talk about it for the moment.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 1944
- Joined: 2010-08-28T11:16:00-07:00
- Authentication code: 8675308
- Location: Montreal, Canada
Re: proper scaling of the Jinc filter for EWA use
@Anthony:
Let's wait for Adam's thesis to come out (or at least let's wait for me to have access to more quantitative results).
This being said, it does appear to me that scaling Jinc-windowed Jinc so that support = lobes gives a worthwhile scheme.
If IM was the kind of environment in which methods are given names based on the "intent" instead of the "how", I'd actually suggest that EWA Lanczos be this scheme: It appears that if you want to get an EWA version of orthogonal Lanczos, EWA Lanczos with support = lobes is a pretty good "clone". You could then access the unscaled one using simple -defines.
In a sense this issue is similar to the question of what is the standard sigma for Gaussian blur used as an interpolator.
For orthogonal Lanczos, no choice. For EWA Lanczos, lots of choices.
Let's wait for Adam's thesis to come out (or at least let's wait for me to have access to more quantitative results).
This being said, it does appear to me that scaling Jinc-windowed Jinc so that support = lobes gives a worthwhile scheme.
If IM was the kind of environment in which methods are given names based on the "intent" instead of the "how", I'd actually suggest that EWA Lanczos be this scheme: It appears that if you want to get an EWA version of orthogonal Lanczos, EWA Lanczos with support = lobes is a pretty good "clone". You could then access the unscaled one using simple -defines.
In a sense this issue is similar to the question of what is the standard sigma for Gaussian blur used as an interpolator.
For orthogonal Lanczos, no choice. For EWA Lanczos, lots of choices.
-
- Posts: 1944
- Joined: 2010-08-28T11:16:00-07:00
- Authentication code: 8675308
- Location: Montreal, Canada
Re: proper scaling of the Jinc filter for EWA use
@Anthony:
Given that with the most important one, EWA Lanczos3, the "sharpened for vertical/horizontal preservation" ones (the current or "new" one) gives results that look almost the same as the unsharpened one (unsurprising since the blur is so close to 1), and that EWA Lanczos2Sharp is, in terms of results, more or less covered by EWA Robidoux/Mitchell, I would like to suggest this:
LanczosSharp just gives Sinc Lanczos when used "orthogonally", and gives the support = lobes Jinc Lanczoses when used the EWA way.
LanczosSharpest just gives Sinc Lanczos when used "orthogonally", and gives the maximally sharpened ones when used the EWA way.
And the current LanczosSharp (with the most recent values of (de)blur, which are just slightly different than the current ones) are just documented in Examples for those who feel like tweaking, but are not accessible w/o -defines.
Would that make sense to you? In your redefined API plans?
Given that with the most important one, EWA Lanczos3, the "sharpened for vertical/horizontal preservation" ones (the current or "new" one) gives results that look almost the same as the unsharpened one (unsurprising since the blur is so close to 1), and that EWA Lanczos2Sharp is, in terms of results, more or less covered by EWA Robidoux/Mitchell, I would like to suggest this:
LanczosSharp just gives Sinc Lanczos when used "orthogonally", and gives the support = lobes Jinc Lanczoses when used the EWA way.
LanczosSharpest just gives Sinc Lanczos when used "orthogonally", and gives the maximally sharpened ones when used the EWA way.
And the current LanczosSharp (with the most recent values of (de)blur, which are just slightly different than the current ones) are just documented in Examples for those who feel like tweaking, but are not accessible w/o -defines.
Would that make sense to you? In your redefined API plans?
-
- Posts: 1944
- Joined: 2010-08-28T11:16:00-07:00
- Authentication code: 8675308
- Location: Montreal, Canada
Re: proper scaling of the Jinc filter for EWA use
I just checked the data and it really looks like EWA Robidoux can be described as a functional clone of (the current) EWA Lanczos2Sharp (or vice versa )NicolasRobidoux wrote:...EWA Lanczos2Sharp is, in terms of results, more or less covered by EWA Robidoux...
So, my suggestion to replace what the Lanczos*Sharp with something else than what it does now do would appear to be a good one.
P.S. EWA Mitchell-Netravali is farther. The "clone" is EWA Robidoux, not EWA Mitchell.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: proper scaling of the Jinc filter for EWA use
That makes sense, and is quiet clear. But I'll make this change for IMv7 only, and later on (beta) when I get to looking at individual options.NicolasRobidoux wrote:LanczosSharp just gives Sinc Lanczos when used "orthogonally",
and gives the support = lobes Jinc Lanczoses when used the EWA way.
LanczosSharpest just gives Sinc Lanczos when used "orthogonally",
and gives the maximally sharpened ones when used the EWA way.
...
Would that make sense to you? In your redefined API plans?
IM7 Work Update: At the moment doing 'percent escapes' in almost all arguments, including geometry arguments. Exceptions are argument that store the value AS-IS for future expansion, EG: -label and -format. After that I can look at adding CLI argument handling to IM "magick scripts".
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: proper scaling of the Jinc filter for EWA use
Sorry what is this in relation too? A documentation fix? If so where?NicolasRobidoux wrote:P.S. EWA Mitchell-Netravali is farther. The "clone" is EWA Robidoux, not EWA Mitchell.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 1944
- Joined: 2010-08-28T11:16:00-07:00
- Authentication code: 8675308
- Location: Montreal, Canada
Re: proper scaling of the Jinc filter for EWA use
I'm trying to establish matching "EWA Keys <-> EWA windowed Jinc" pairs.anthony wrote:Sorry what is this in relation too? A documentation fix? If so where?NicolasRobidoux wrote:P.S. EWA Mitchell-Netravali is farther. The "clone" is EWA Robidoux, not EWA Mitchell.
I was stating that the Keys spline which gives an "equivalent" to EWA Lanczos2Sharp is indeed EWA Robidoux, not EWA Mitchell.
Makes sense now?
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: proper scaling of the Jinc filter for EWA use
Got ya.NicolasRobidoux wrote:I'm trying to establish matching "EWA Keys <-> EWA windowed Jinc" pairs.anthony wrote:Sorry what is this in relation too? A documentation fix? If so where?NicolasRobidoux wrote:P.S. EWA Mitchell-Netravali is farther. The "clone" is EWA Robidoux, not EWA Mitchell.
I was stating that the Keys spline which gives an "equivalent" to EWA Lanczos2Sharp is indeed EWA Robidoux, not EWA Mitchell.
Makes sense now?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 1944
- Joined: 2010-08-28T11:16:00-07:00
- Authentication code: 8675308
- Location: Montreal, Canada
Re: proper scaling of the Jinc filter for EWA use
My current opinion is that setting the EWA Jinc Lanczos 3 (de)blur so that the radius of the EWA disk is exactly the same as the number of lobes produces a scheme which is just a nudge too sharp.
That is: My guess is that the best all around "sharp" EWA Jinc Lanczos 3 scheme will have a -define filter:blur values which is slightly above .9264075766146068 (the value which makes the filter support a disk of radius 3). How much above? I don't really know. But I am fairly certain that it is less than .9765193279, the (de)blur value which ensures that the radius of the disk is exactly sqrt(3^2+1^2). Probably more than a bit less.
I have some ideas RE: a criterion that would make it show up, but they are not solid, and the amount of programming involved in computing the value is not something I have time for right now.
That is: My guess is that the best all around "sharp" EWA Jinc Lanczos 3 scheme will have a -define filter:blur values which is slightly above .9264075766146068 (the value which makes the filter support a disk of radius 3). How much above? I don't really know. But I am fairly certain that it is less than .9765193279, the (de)blur value which ensures that the radius of the disk is exactly sqrt(3^2+1^2). Probably more than a bit less.
I have some ideas RE: a criterion that would make it show up, but they are not solid, and the amount of programming involved in computing the value is not something I have time for right now.
Last edited by NicolasRobidoux on 2012-07-19T05:33:43-07:00, edited 2 times in total.
Re: proper scaling of the Jinc filter for EWA use
Code: Select all
sqrt(3^2+1^2). Probably more than a bit less.
Sorry if I've lost the plot on this, but how does the geometric mean of 3 adn 1 give you exactly three lobes ?
-
- Posts: 1944
- Joined: 2010-08-28T11:16:00-07:00
- Authentication code: 8675308
- Location: Montreal, Canada
Re: proper scaling of the Jinc filter for EWA use
@imaggie: Sorry, I was sloppy, and I did not explain what I was doing.
-define filter:blur=.92... allows you to rescale the Jinc 3-lobe so that its support is a disk of radius exactly 3. This is the basis for the method I call "EWA LanczosRadius3", which has been tested quite a bit in some of my other threads. Now, I >>visually<< find this filter to have just a bit too much aliasing for my taste when enlarging. On the other hand, I find EWA LanczosSharp a bit too soft (awesome lack of jaggies, though). So, I'm looking for a (de)blur between the two that would have some basis for being called "optimal".
(3,1) is the position of the nearest "untouched" input pixel location when the disk is centered at an input pixel location located at (0,0) and one slowly enlarges the disk from radius 3.
-define filter:blur=.92... allows you to rescale the Jinc 3-lobe so that its support is a disk of radius exactly 3. This is the basis for the method I call "EWA LanczosRadius3", which has been tested quite a bit in some of my other threads. Now, I >>visually<< find this filter to have just a bit too much aliasing for my taste when enlarging. On the other hand, I find EWA LanczosSharp a bit too soft (awesome lack of jaggies, though). So, I'm looking for a (de)blur between the two that would have some basis for being called "optimal".
(3,1) is the position of the nearest "untouched" input pixel location when the disk is centered at an input pixel location located at (0,0) and one slowly enlarges the disk from radius 3.
-
- Posts: 1944
- Joined: 2010-08-28T11:16:00-07:00
- Authentication code: 8675308
- Location: Montreal, Canada
Re: proper scaling of the Jinc filter for EWA use
My wish for slightly less aliasing without loss of sharpness may be caught in a zero sum game. Which means that "EWA Lanczos Radius 3" would be as good, or as bad, as they come.
And there is something to be said for never needing more than a 6x6 square patch of data to compute a value when not downsampling. The "Radius 3" deblur is the largest one that does that.
And there is something to be said for never needing more than a 6x6 square patch of data to compute a value when not downsampling. The "Radius 3" deblur is the largest one that does that.
Re: proper scaling of the Jinc filter for EWA use
What is 3.1 ? Presumably this is not anisotropic in x,y . Does this mean one sinc lobe equals three jinc lobes?(3,1) is the position of the nearest "untouched" input pixel location when the disk is centered at an input pixel location located at (0,0) and one slowly enlarges the disk from radius 3.
I'm usually a bit hesitant about this kind of arbitrary tweaking other than just to explore how things work.
Soften or blurring is basically introducing errors. Adding some small slice of an extra lobe is to add an arbitrary amount of error. Now there will be some subjective point where the arbitrary errors "optimally" masks the ringing defects.
This will largely depend upon the nature of the image: degree of colour blocks, sharp line contrasts and angle of image lines to the sampling matrix.
As I am sure you are aware there is a whole cartography of sharpness/blurring etc. for the various kinds of splines that can be used for interpolation.
Now I realise that you are searching out the last grain of improvement at this stage and the differences are barely perceptible but is adding such an arbitrary slice of a lobe mathematically any more useful than adding some small random signal or small gaussian blurring?
Adding in more lobes would generally increasing ringing, so is the subjective improvement from adding/subtracting in a slice of a lobe preferable to some other softening distortion?
Re: proper scaling of the Jinc filter for EWA use
Just thinking on the hoof here, how does adding a small slice of a lobe compare to removing a similar amount?
Does adding a small slice soften , as I suspect, or increase the ringing due having fractionally more lobes ?
Does adding a small slice soften , as I suspect, or increase the ringing due having fractionally more lobes ?