Page 9 of 19
Re: best downsampling method for DSLR photographs
Posted: 2012-05-20T04:51:54-07:00
by NicolasRobidoux
@Pictus: There is another bias that I forgot to state: My current "hunt" primarily has to do with figuring out what filters to implement for GEGL and VIPS, for which speed matters more, and which are not really designed to use the shortcuts that allow orthogonal methods to be faster (like ImageMagick does). Implementing tensor Lanczos for downsampling in GEGL would actually lead to a slower method than EWA, for architectural reasons that I don't want to go into. And GEGL intends to be real time. On top of it, to seamlessly integrate tensor Lanczos downsampling, I'd have to use a brand new "resampling structure" only discussed with Anthony so far, structure which consequently requires careful programming (and some new geometrical calculations).
With this out of the way: A four lobe method is considerably slower than a three lobe one. In the context of real time computation, this is a big deal. It appears that some of the four lobe methods may antialias better than all the other methods, but the difference is minute. Not worth it, for what's most pressing for me right now. And there is a cost in wider haloing, which matters to me since the methods are to be used for other things than downsampling DSLR images. Also: The antialising gain going from 2 to 3 lobes is a big deal. Going from 3 to 4, not so much.
This also explains my interest in the Keys cubics: If I can get almost as good results with half the data points, this may be a winning speed/quality trade-off, esp. if I get some flexibility in the flavor of the result. And then I don't have to spend time computing the relative error minimax approximations of the kernels, because Keys cubics are trivial to compute. (Doing so is on my TODO list, but I'd rather not have it near the top.)
The short of it: You won't find me disagreeing that a four lobe method may turn out to be better for DSLR photograph downsampling than all the three lobe methods. But I don't have time to figure out which one right now.
Re: best downsampling method for DSLR photographs
Posted: 2012-05-20T04:56:59-07:00
by henrywho
Pictus wrote:convert BackPack.png -filter Lanczos -define filter:lobes=4 -define filter:blur=0.88451002338585141 -resize 1200x1200 Lanczos_4.png
....
Aren't these blur values designed for distort resize?
Re: best downsampling method for DSLR photographs
Posted: 2012-05-20T05:03:55-07:00
by NicolasRobidoux
henrywho wrote:Pictus wrote:... blur=0.88451002338585141
....
Aren't these blur values designed for distort resize?
Yes, but once you realize you can deblur distort resize methods, nothing keeps you from doing the same with resize.
It actually makes sense to do it with tensor windowed methods when downsampling, to get a bit more "punch".
When upsampling, the back of my envelope says it is a very bad idea to change the blur away from 1 with windowed Sincs, but I've been proven wrong before.
P.S. This being said, I think that Pictus' comparison would be more convincing if it used, say, tensor (-resize) Lanczos 2-, 3- and 4-lobes without any deblur, or at least with the same deblur across the board.
P.S. 2 Actually, the three deblurs are so close that I think this is a convincing comparison.
Re: best downsampling method for DSLR photographs
Posted: 2012-05-20T05:09:06-07:00
by NicolasRobidoux
Forgot the most important thing:
Pictus, thank you for these examples that make really clear that the moire suppression power of (tensor) Lanczos 4 is stronger than the one for Lanczos 3, itself stronger than Lanczos 2.
Re: best downsampling method for DSLR photographs
Posted: 2012-05-20T05:14:28-07:00
by NicolasRobidoux
I stand to be corrected, but I still believe that some of the EWA Lanczoses antialias more effectively than (tensor) Lanczoses at matching sharpness. I'm upping the status of this statement from "hunch" to "conjecture".
(This being said, my former grad student Chantal Racette has something to say about my conjectural batting average...)
Re: best downsampling method for DSLR photographs
Posted: 2012-05-20T05:25:18-07:00
by NicolasRobidoux
Pictus wrote:...
Ahhhh!
In my testes, images with heavy PP(post processing) have a tendency to be worst when using
linear light due to the fact that the PP may already have enhanced the details...
This is the best possible explanation I've seen so far of some of what I'm seeing in my student Adam Turcotte's thesis.
I'll have to name you in the thesis (for other reasons than your contributions to the test image bank).
Re: best downsampling method for DSLR photographs
Posted: 2012-05-20T07:59:57-07:00
by henrywho
Pictus wrote:In my testes, images with heavy PP(post processing) have a tendency to be worst when using
linear light due to the fact that the PP may already have enhanced the details...
I tend to take a simpler explanation. Artifacts are unwanted patterns formed by interpolated values generated by resizers. These patterns are somehow there for both sRGB and linear light operations. It's less obvious when using sRGB light operations because sRGB interpolated values are dimmer than they should have been.
Re: best downsampling method for DSLR photographs
Posted: 2012-05-20T08:01:59-07:00
by NicolasRobidoux
Two nice images to test downsampling with, courtesy of John Cupitt:
http://www.rollthepotato.net/~john/nina.jpg
http://www.rollthepotato.net/~john/theo.jpg
Unfortunately, autofocus missed the pupils of Nina.
For Theo, the eyelashes are key to produce a catchy downsample.
----
I'm not going to touch them for a bit, so one of you can have a go.
Re: best downsampling method for DSLR photographs
Posted: 2012-05-20T08:40:57-07:00
by NicolasRobidoux
The one big open question is this: Can one get negative total weights with some of the sharper EWA methods, and if so, which ones. I'm going to have to start checking that at some point.
Conjecture With my favorite methods, no negative total weight can occur.
Re: best downsampling method for DSLR photographs
Posted: 2012-05-20T10:51:53-07:00
by NicolasRobidoux
Pictus wrote:...
-Convert to TIFF or PNG
...
Not necessary. Just let IM gobble the input image and convert it internally to the bit depth (default 16) it was compiled with; It will run faster this way. If you want to make sure to produce a 16-bit image, insert -depth 16 somewhere reasonable, or use define png:bit-depth=16 if your output image is PNG or ...
Unless I misunderstood and you were talking about the final result being TIFF or PNG, not converting the input image before resizing.
Re: best downsampling method for DSLR photographs
Posted: 2012-05-20T11:14:18-07:00
by fmw42
I tend to take a simpler explanation. Artifacts are unwanted patterns formed from interpolated values generated by resizers. These patterns are somehow there for both sRGB and linear light operations. It's less obvious when using sRGB light operations because sRGB interpolated values are dimmer than they should have been.
I make no claim to understanding the issues with photography and resizing. But if what you say is true, why not use an even more extreme gamma change on both ends rather than just the .45455 and inverse built into sRGB? Does that make any sense? Has anyone tried pushing gamma to see how far to take it and if it gets better results?
Re: best downsampling method for DSLR photographs
Posted: 2012-05-20T11:27:14-07:00
by NicolasRobidoux
Fred: I think that pretty much everybody agrees that through linear light is generally better.
I found, however, that generally is not the same as always. And I find myself pretty mystified by that.
However, without a "golden standard", I'd be really weary, at least at this point, of recommending to someone that they will get better quality using plain sRGB when resizing "blindly". In the test suite, we pretty much know "what perfect is". Generally, you don't, because if you did, you'd just use that.
-----
I'm hoping that Adam's thesis will help explain what I'm mystified about. At this point, I'm collecting informal corroborating evidence and possible explanation.
MAYBE resampling should be done through something which is neither some form of linear light, nor sRGB (when the source and/or the target are sRGB), as you (and, indirectly, Henry) suggest may potentially be useful. An intermediate colourspace that either expands or compresses both the light and dark ends of the spectrum?
No clue.
Re: best downsampling method for DSLR photographs
Posted: 2012-05-20T11:38:17-07:00
by fmw42
An intermediate colourspace that either expands or compresses both the light and dark ends of the spectrum?
Yes, that might be an interesting experiment. Perhaps for another of your students down the road.
Re: best downsampling method for DSLR photographs
Posted: 2012-05-20T17:18:26-07:00
by henrywho
fmw42 wrote:But if what you say is true, why not use an even more extreme gamma change on both ends rather than just the .45455 and inverse built into sRGB? Does that make any sense?
I just find linear light
downsize produces images that match better (brightness wise) to viewing the original 1:1 image a few feet from the monitor. For upsize, I don't know; the magnifier is showing me the LCD spots, nothing more
The "-gamma" operator is useful some times, when I wanna downsize CG as web buttons. "... -gamma 2 .... -resize 10% .... -gamma 0.5" does help building "strong" borders for dark details over light background.
Re: best downsampling method for DSLR photographs
Posted: 2012-05-20T17:54:22-07:00
by NicolasRobidoux
In Adam's thesis, credit for EWA Catrom will be given to Henry HO, unless someone points me to an earlier reference.
Anthony showed the basis function a while ago in
http://www.imagemagick.org/Usage/resize ... terpolated, and I tried it briefly for upsampling a while ago and immediately went "Yuck!", but Henry is the first one who found a plausible use for it (that I know of), namely sharpening downsampling.