best downsampling method for DSLR photographs

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Locked
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: best downsampling method for DSLR photographs

Post by NicolasRobidoux »

Pictus wrote:I prefer the backpack texture with orthogonal...
Score one for orthogonal Lanczos 3 (which, mind you, is an unbelievably good scheme).
(Yes, I know you used a (de)blurred version.)

Also: Sorry no reply RE: Kaiser. You are not using bleeding edge enough IM. I'll try to find the time to add samples.

NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: best downsampling method for DSLR photographs

Post by NicolasRobidoux »

Arrghhhh! Much of the moire I was seeing came from some sort of bug when windows are maximized: I think the WM was resampling my downsample, so if it was sharp it was adding its own moire to the mix.

(Will teach me to use a bleeding edge OS/WM.)

Fred, Luiz and Henry: Now I see what you're seeing :-)

henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Re: best downsampling method for DSLR photographs

Post by henrywho »

Pictus wrote:use some contrast detect algorithm to choose the good one... :)
I think the range from EWA-Robidoux to EWA-Catrom should cover most uses.

henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Re: best downsampling method for DSLR photographs

Post by henrywho »

NicolasRobidoux wrote:Do you see problems with the downsample of the apartments image I put in the test image bank? If you do (please explain), I may redo it.
No, it's the image itself, containing high contrast sharp lines. I tried sizing it down by 50% and then up by 2X, the lines become awful.

NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: best downsampling method for DSLR photographs

Post by NicolasRobidoux »

I added Kaiser-windowed Sinc and Jinc methods, with reasonable values for the Kaiser beta, to the fly downsamples collection. Code:

Code: Select all

magick original.jpg -colorspace RGB -filter Kaiser -define filter:kaiser-beta=5.36 -define filter:lobes=2 -distort Resize x573 -colorspace sRGB Kaiser2.png
magick original.jpg -colorspace RGB -filter Kaiser -define filter:kaiser-beta=5.36 -define filter:lobes=2 -resize x573 -colorspace sRGB oKaiser2.png
magick original.jpg -colorspace RGB -filter Kaiser -define filter:kaiser-beta=8.93 -define filter:lobes=3 -distort Resize x573 -colorspace sRGB Kaiser3.png
magick original.jpg -colorspace RGB -filter Kaiser -define filter:kaiser-beta=8.93 -define filter:lobes=3 -resize x573 -colorspace sRGB oKaiser3.png
magick original.jpg -colorspace RGB -filter Kaiser -define filter:kaiser-beta=12.15 -define filter:lobes=4 -distort Resize x573 -colorspace sRGB Kaiser4.png
magick original.jpg -colorspace RGB -filter Kaiser -define filter:kaiser-beta=12.15 -define filter:lobes=4 -resize x573 -colorspace sRGB oKaiser4.png
You need extremely recent IM7 alpha (through svn or the daily source archive) to have these commands run correctly.

NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: best downsampling method for DSLR photographs

Post by NicolasRobidoux »

Kaiser3 seems to give good results. I'll see what comes out of Adam's thesis, and will think about optimizing taking "2D" explicitly into account (like I did with LanczosSharp, LanczosSharpest, Robidoux, RobidouxSharp...).

User avatar
Pictus
Posts: 13
Joined: 2012-05-12T11:52:50-07:00
Authentication code: 13
Location: Teresópolis - Rio de janeiro - Brasil

Re: best downsampling method for DSLR photographs

Post by Pictus »

henrywho wrote: I think the range from EWA-Robidoux to EWA-Catrom should cover most uses.
But I am still friend to orthogonal Lanczos/Mitchell and the “moiréless” 4 lobes thing... :)

User avatar
Pictus
Posts: 13
Joined: 2012-05-12T11:52:50-07:00
Authentication code: 13
Location: Teresópolis - Rio de janeiro - Brasil

Re: best downsampling method for DSLR photographs

Post by Pictus »

NicolasRobidoux wrote:Kaiser3 seems to give good results. I'll see what comes out of Adam's thesis, and will think about optimizing taking "2D" explicitly into account (like I did with LanczosSharp, LanczosSharpest, Robidoux, RobidouxSharp...).
My curiosity about Kaiser is that I read somewhere it may be better than Lanczos...

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...

NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: best downsampling method for DSLR photographs

Post by NicolasRobidoux »

With what I see for the fly, orthogonal Lanczos is in the "bad" bin for me as far as downsampling goes: too much moire compared to several other methods.
Last edited by NicolasRobidoux on 2012-05-19T13:23:40-07:00, edited 1 time in total.

NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: best downsampling method for DSLR photographs

Post 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...
Uhmmm! This makes sense: When a human postprocesses, they basically do it to get something they like in a "psychovisual colourspace" which resembles sRGB more than linear light (and which may "clamp" colours they created that fall outside of what their terminal/eye can see). Treating the result as if it's linear light is consequently a complete fiction, and like other plausible inferences (low in trans fats -> good for you, trickle-down economics, etc), it has a high failure rate.
Last edited by NicolasRobidoux on 2012-05-19T15:29:01-07:00, edited 4 times in total.

User avatar
Pictus
Posts: 13
Joined: 2012-05-12T11:52:50-07:00
Authentication code: 13
Location: Teresópolis - Rio de janeiro - Brasil

Re: best downsampling method for DSLR photographs

Post by Pictus »

NicolasRobidoux wrote:With what I see for the fly, orthogonal Lanczos is in the "bad" bin for me as far as downsampling goes: too much moire compared to several other methods.
True...
What is good for image Y is not for X, life is hard for pixel peepers... :lol:
The pixel peeper I am talking, it is me...

NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: best downsampling method for DSLR photographs

Post by NicolasRobidoux »

Pictus wrote:... and the “moiréless” 4 lobes thing...
Could you please be a bit more specific?

NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: best downsampling method for DSLR photographs

Post by NicolasRobidoux »

I hear that newspaper photographers USM like mad.

I just wrote a letter to the editor of the Sudbury Star raising concerns that artificial acutance may conflict with unbiased reporting.
Last edited by NicolasRobidoux on 2012-05-19T19:45:58-07:00, edited 3 times in total.

NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: best downsampling method for DSLR photographs

Post by NicolasRobidoux »

On the basis of the few downsampling examples I've scrutinized, here are MY (most likely biased) CONCLUSIONS.

BEST OVERALL:
EWA (-distort Resize) LanczosSharp (the new one, which is not very different from the current one, and also not very different from plain EWA Lanczos; Henry calls this scheme JincJinc3) is the best overall. It's a very slightly deblurred Jinc-windowed Jinc 3-lobe Elliptical Weighted Averaging.

FOR SHARPER RESULTS:
EWA (-distort Resize) Jinc3Radius3: EWA Lanczos deblurred more than LanczosSharp (just enough so that the unscaled support has radius 3 instead of a radius equal to the first root of the Jinc function).

I am biased toward schemes that fight off moire, are reasonably respectful of local tone, and don't have halos that extend too far (no 4-lobe method makes my short list, even though some of them give good results). I am also partial to schemes that do well when upsampling, not only when downsampling.

CLOSE BUT NO CIGAR:
The various EWA Keys cubics, starting with Robidoux, are good and they make it easy to adjust the sharpness <-> aliasing balance with one intuitive parameter that controls the blur (and replaces a final USM), but they don't do as good a downsampling job as the above two, unless tight halos are desired (3-lobe methods have double halos; EWA Keys cubics, single halos, which are mild unless the blur parameter is close to 0).
Tensor (-resize) Lanczos (Sinc-windowed Sinc 3, the classic "high quality downsampler") does really well, and is sharp, but the fly results kill it. IMHO It does not low pass nearly as well as the best EWA schemes. (This is suggested by the theory: Jinc is the "ideal" 2D filter, not (tensor) Sinc, which fails to be isotropic in its filtering power.)

-----

This is not set in stone, but I'm starting to have a more solid opinion.

P.S. Did not have the heart to carefully study things like Mitchell-Lanczos blends, which really should be done in HDRI to avoid effects of clamping before blending (unless this is intentional). And I may have to have a double take comparing, as a group, tensor Keys with EWA Keys. I may have been guilty of selection bias http://en.wikipedia.org/wiki/Selection_bias w.r.t. EWA VS tensor Keys Cubics. Although I do think that the EWA ones win.
Last edited by NicolasRobidoux on 2012-05-20T08:05:21-07:00, edited 1 time in total.

User avatar
Pictus
Posts: 13
Joined: 2012-05-12T11:52:50-07:00
Authentication code: 13
Location: Teresópolis - Rio de janeiro - Brasil

Re: best downsampling method for DSLR photographs

Post by Pictus »

In case anyone else happened to see this post for the first time, here the “cake recipe” for easy following.

-With the backpack http://www.mediafire.com/i/?uz8dphpj6q0y6n5
-Convert to TIFF or PNG
-3 versions(4, 3 and 2 lobes) for ImageMagick, can use orthogonal or EWA, deblurred or not

convert BackPack.png -filter Lanczos -define filter:lobes=4 -define filter:blur=0.88451002338585141 -resize 1200x1200 Lanczos_4.png

convert BackPack.png -filter Lanczos -define filter:blur=0.88549061701764 -resize 1200x1200 Lanczos_3.png

convert BackPack.png -filter Lanczos2 -define filter:blur=0.88826421508540347 -resize 1200x1200 Lanczos_2.png

In photoshop upsampled to 300% nearest neighbor and used Topaz Detail with Small Boost 0.40 to easy spot the differences, here the PSD http://www.mediafire.com/i/?22clhf5clfoqf01

Image
here the 3 to 4 lobes http://i605.photobucket.com/albums/tt13 ... ff/3-4.gif

Your initial conclusions are a very welcome starting point, and so the Henrywho ones.
For mine, looks like I am a bit less “clear”, but for sure more happy.

Locked