Page 2 of 19
Re: best downsampling method for DSLR photographs
Posted: 2012-05-12T11:35:49-07:00
by NicolasRobidoux
henrywho wrote:Do you mean " ... -define filter:filter=Sinc -define filter:window=Sinc -define filter:lobes=2 -distort resize ... "?
Yes.
henrywho wrote:BTW, while I am suggesting EWA Lagrange downsize as a better alternative to the common downsize+USM approach, my current choice of downsizing it still EWA-JincJinc3.
I understood.
Basically, the search for a good downsizer has been split in two:
"Neutral" downsampler.
"Sharpening" downsampler, that recent DSLR photographers will like, and which would obviate the need to use USM while simultaneously reducing the amount of aliasing.
For the second search, I'd put my biased money on one of the heavily sharpened EWA 3- or 4-lobes (heavily sharpened = blur significantly less than 1). I believe that the EWA Jinc Lanczoses are much better at antialiasing than the standard (tensor Sinc) Lanczoses.
Re: best downsampling method for DSLR photographs
Posted: 2012-05-12T11:38:07-07:00
by NicolasRobidoux
... and I may need to add a new acronym to my collection: TYH ("Thank you Henry")
Re: best downsampling method for DSLR photographs
Posted: 2012-05-12T12:26:08-07:00
by NicolasRobidoux
@henriwho: I'd put my money on a heavily sharpened EWA Jinc Lanczos way before I'd put it on EWA Sinc Lanczos. But if EWA Catrom and Lagrange work well for you, this means that my intuition is (possibly more than) a bit off. After hearing from Anthony RE: the breakdown of Sinc-windowed Sinc in some situations (summarized here:
viewtopic.php?f=22&t=20960#p84624), I would never have imagined EWA Catrom or Lagrange to be usable, let along useful! And I would think that EWA Sinc-windowed Sinc would work better than EWA Catrom or Lagrange, esp. for downsampling. So...
Re: best downsampling method for DSLR photographs
Posted: 2012-05-12T17:37:54-07:00
by NicolasRobidoux
(Warning: possible Big Foot in mouth sighting ahead.)
Let me make an hypothesis RE: why some, or at least some portions of, images may be more accurately downsampled is sRGB than going through linear light, even if the conversion is lossless: It's because of how a combination of clamping and averaging interacts with a nonlinear transformation.
To keep the arithmetic simple, I'll assume that sRGB is a power transformation with gamma = 2, and that I am downsampling a 9x9 image of 1 pixel wide vertical stripes down to 1 pixel with box filtering. In other words, my final 1x1 image is the average of the whole image.
Suppose that the "scene" that was captured was a greyscale affine gradient with values, from left to right, equal to 0 7 12 15 16 17 20 25 32. In linear light, the average value, and consequently the linear light value of my 1x1 downsample, is 16.
However, the black point was (coincidentally) moved to 16 in linear light, during raw processing or whatever. W.r.t. to this black point, the exact average value, in linear light, is now 0 which, converted to sRGB, is also 0.
Now, let's see what happens to the image when things are first converted to sRGB.
In linear light with this black point, the vertical stripes have values 0 0 0 0 0 1 4 9 16. In "sRGB" (remember that encoding uses the reciprocal of gamma), the values are 0 0 0 0 0 1 2 3 4.
Now, I again downsample with 9x9 box filtering.
If I use "sRGB" resizing, my new "sRGB" image has an average of (1+2+3+4)/9 = 1.11.
If I losslessly convert my "sRGB" image back to linear light, I get a one pixel linear light image with value (1+4+9+16)/9 = 3.33. If I now convert back to "sRGB", I get sqrt(3.33)=1.83.
The "sRGB" result is closer to the "perfect" one (namely 0) than the linear light result!
Conjecture If the black point was moved up significantly somehow, "darks" will be more accurate if averaged in sRGB. No matter what, however, "lights" will be more accurate if averaged in linear light (it's because the light end of "sRGB" is kinda like doing things in reverse video with something like the reciprocal of gamma).
Note that the sRGB people actually use a linear (proportional) relationship between linear light and sRGB at the dark end. That is, they flattened the nonlinearity exactly where it could hurt the most. So, the above effect should be, in general, really small. Probably insignificant.
On the other hand, things of course are more complicated than this: How does the combination of clamping and nonlinearity interact with a filter with negative weights applied to an area with both light and dark pixels?
----
Maybe I'm off the track, but I am still mystified by the preliminary results of my grad student Adam Turcotte which suggest that enlarging is better done in sRGB than linear light. The above is my attempt at making sense of this nonsense.
Re: best downsampling method for DSLR photographs
Posted: 2012-05-12T22:54:21-07:00
by henrywho
NicolasRobidoux wrote:Which one? What you call JincJinc3 (which is the "improved" version of the current EWA LanczosSharp, with a blur barely below 1)?
Over/strong-sharpening downsampler means EWA-Lagrange, not JincJincSharpest3 or 4.
BTW, orthogonal box (odd integer ratio) downsizing of real life photos like
http://www.dcfever.com/cameras/enlarge.php?id=6967 is generating moire patterns. This Nikon D800E (full-frame sensor without AA filter) seems really giving fine details!
Re: best downsampling method for DSLR photographs
Posted: 2012-05-12T23:23:32-07:00
by NicolasRobidoux
@henrywho: Interesting. (TYH!)
Re: best downsampling method for DSLR photographs
Posted: 2012-05-13T05:32:30-07:00
by NicolasRobidoux
So far, when downsampling images produced with a high quality, recent vintage DSLR, my biased eye prefers the EWA (Jinc) Lanczoses over the standard (tensor Sinc) lanczoses.
Pushing -define filter:blur=VALUE down from 1 makes things sharper (of course! I think it's mentioned in Anthony's IM Resize example page). Back of the envelope says that you should never go much below sqrt(2)/2 (about .7), although Henry made pretty clear that the backs of my envelopes don't always have a good return address. This being said, I expect that you will get more moire if you push the blur down a lot.
Three lobes (the Lanczos default) makes things look more "natural".
However, lobes = 4 (-define filter:lobes=4) seems to anti-alias a bit more (no big surprise) and makes things very slightly sharper, compared to 3 lobes. When pixel peeping, as mentioned by Fred ages ago, it gives the image kind of a tight USM look, the kind that many people seem to like. On a calibrated monitor, I imagine that many would like this effect. On a Galaxy looked at indoors, say, I'm not so sure. (I am not fond of haloing.)
Comment: A lot of people like the "in your face" look. My understanding is that this annoys quite a few graphic designers. ("If my brother in law yells "Isn't the bass great!" one more time, I'm buying him a subscription to Gramophone.")
I've only looked at results of the linear light (through -colorspace) toolchain.
-----
The one thing I've not explored is that messing with blur to get more sharpness is also something that could be done with standard (tensor Sinc) Lanczos. Makes lots of sense, though: When downsampling, there is no overwhelming reason to stick to blur=1.
-----
"Too many resampling methods, too little time."
Re: best downsampling method for DSLR photographs
Posted: 2012-05-13T05:54:59-07:00
by NicolasRobidoux
Among them all, I like the "maximally sharpened" Jinc Lanczos 3-lobe (blur=0.88549061701764) for a fairly sharp yet "natural" look, and Jinc Lanczos 4-lobe (blur=0.88451002338585141) for a "definitely sharpened" look, a lot.
P.S. I've not compared with the (tensor) Sinc Lanczos/Mitchell mix. I have looked at mixing Sinc and Jinc Lanczos, and I feel that Sinc brings Jinc down. Back of the envelope says that someone who likes to blend Sinc Lanczos with Mitchell may actually like EWA (-distort Resize) LanczosSharp, or the "radius 3" version of EWA Jinc Lanczos, namely
Code: Select all
magick INPUT.IMG -colorspace RGB -filter Lanczos -define filter:blur=.9264075766146068 -distort Resize WIDTHxHEIGHT -colorspace sRGB -strip OUTPUT.IMG
(with the usual caveat that this uses the recent, IM7, use of -colorspace).
Re: best downsampling method for DSLR photographs
Posted: 2012-05-13T06:26:47-07:00
by NicolasRobidoux
'Tis the time to set me straight, guys! What do you like?
Re: best downsampling method for DSLR photographs
Posted: 2012-05-13T07:52:57-07:00
by henrywho
NicolasRobidoux wrote:'Tis the time to set me straight, guys! What do you like?
Test cases (all downsized to 1000 on the longest side) are:
Backpack:
http://dcfever.com/cameras/viewsamples. ... cture=6967
RockBeach:
http://dcfever.com/cameras/viewsamples. ... cture=5587
Bike:
http://dcfever.com/cameras/viewsamples. ... cture=5594
-> EWA-SincSinc3 and 4 are altering the brightness of areas packed with small high-contrast spots.
-> EWA-SincSinc2 does so too, though in a much lesser extent. And EWA-Catrom too, yet milder.
-> EWA-Lagrange is only a little less sharp but does not show this problem (at least easily detectable flipping back and fore with EWA-Robidoux).
-> Orthogonal LanczosSharp is always a bit bigger than JincJinc4Sharpest but is not really sharper.
Re: best downsampling method for DSLR photographs
Posted: 2012-05-13T09:45:30-07:00
by henrywho
NicolasRobidoux wrote:In linear light with this black point, the vertical stripes have values 0 0 0 0 0 1 4 9 16. In "sRGB" (remember that encoding uses the reciprocal of gamma), the values are 0 0 0 0 0 1 2 3 4.
After pushing the shadow, those dark details are clipped as zero and lost (we do not have negative brightness). sRGB just happens to produce a smaller average.
Let's try another case: 30 80 130 180 235 236 237 238 239 (linear) ... avg = 178
then we boost the highlight: 50 100 150 200 255 255 255 255 255 (+20) ... avg = 197
converting to sRGB gives: 122 167 200 228 255 255 255 255 255 (take gamma 2.2 for simplicity) ... avg = 221 (sRGB) = 186 (linear)
This time we have 178 > 177 (= 197-20) > 166 (= 186-20).
NicolasRobidoux wrote:Maybe I'm off the track, but I am still mystified by the preliminary results of my grad student Adam Turcotte which suggest that enlarging is better done in sRGB than linear light. The above is my attempt at making sense of this nonsense.
Are the sRGB interpolated values dampening the artifacts? lol
Re: best downsampling method for DSLR photographs
Posted: 2012-05-13T10:06:19-07:00
by NicolasRobidoux
henrywho wrote:...
then we boost the highlight: 50 100 150 200 255 255 255 255 255 (+20) ... avg = 197
...
Indeed things may depend on whether you raise or lower the black or white points, and whether the active clamping is floor or ceiling.
-----
I'll wait for Adam's final results to comment more.
Re: best downsampling method for DSLR photographs
Posted: 2012-05-13T11:31:25-07:00
by Bonzo
I am afraid that I can not view your images henrywho as the page will not load. Last time I looked at one of your pages it didn't load until I pressed stop in the browser. This time tried on IE and Firefox and they are the same - just says transfering data from dcfever.com
Both times I gave up at about 3 min.
Re: best downsampling method for DSLR photographs
Posted: 2012-05-13T12:37:49-07:00
by NicolasRobidoux
@Bonzo: I put a copy of the full size backpack image here:
http://web.cs.laurentian.ca/nrobidoux/m ... iginal.jpg. Indeed, it took me some time to download this from the (Honk Kong?) server.
P.S. Removed, because there may be copyright issues.
Re: best downsampling method for DSLR photographs
Posted: 2012-05-13T12:50:27-07:00
by NicolasRobidoux
I put some downsamples, all through linear light (with -colorspace), and all with size 640x427, here:
Standard tensor Sinc-windowed Sinc Lanczos 3:
http://web.cs.laurentian.ca/nrobidoux/m ... /Sinc3.png
Standard tensor Sinc-windowed Sinc Lanczos 4:
http://web.cs.laurentian.ca/nrobidoux/m ... /Sinc4.png
Jinc-windowed Jinc EWA Lanczos 3 "maximally sharpened":
http://web.cs.laurentian.ca/nrobidoux/m ... arpest.png
Jinc-windowed Jinc EWA Lanczos 4 "maximally sharpened":
http://web.cs.laurentian.ca/nrobidoux/m ... arpest.png
Jinc-windowed Jinc EWA Lanczos 3 "radius 3":
http://web.cs.laurentian.ca/nrobidoux/m ... adius3.png
Jinc-windowed Jinc EWA Lanczos 4 "radius 4":
http://web.cs.laurentian.ca/nrobidoux/m ... adius4.png
EWA RobidouxSharp:
http://web.cs.laurentian.ca/nrobidoux/m ... xSharp.png
I'll add a few after dinner.
It's not as if the differences just jump at you.
@Henry: Could you let me know if it's OK that I posted these images? If not, I'll remove them.