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?".
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 »

Bingo! For downsampling, Jinc-windowed Sinc 3-lobes sucks. The really really close (on paper) standard Lanczos does not suffer from the tone drift from hell. :shock:
P.S. No, that's not it. They all suffer the same way, and what's happening is that moire is changing our perception of tone. Where there are moire rings, we perceive things as being darker.
-filter Cosine (Cosine-windowed Sinc) -resize is just the same as Ginseng is just the same as Lanczos, basically.
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 »

In the case of this fly test, the window function that does the best out of Jinc, Sinc and Cosine, is Cosine, by a minute amount (Welch too), strictly in terms of moire reduction.
That is, Cosine-windowed Sinc 3-lobe comes out on top for downsampling.
I'm going to have to have a second look at Cosine-windowed Sinc 3-lobe for upsampling, because in quantitative tests soon to be published by my student Adam Turcotte it's arguably the best 3-lobe method.
Last edited by NicolasRobidoux on 2012-09-20T17:19:13-07:00, edited 2 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 »

OK: Looking at the backpack results, it's easy to see what's going on:
Ginseng has noticeably less second halo than Cosine and Welch, and about the same as Lanczos. So, it's a trade-off between a minute amount of additional antialiasing and a significant increase in the second halo.
-----
I think I'll stick to Ginseng.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: best downsampling method for DSLR photographs

Post by anthony »

henrywho wrote:EWA Catrom, "Cub-grange" (cubic @ c=0.4846)
What is a Cub-grange filter? What makes it special? And why this name? Is it related to Lagrange in some way?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: best downsampling method for DSLR photographs

Post by anthony »

Perhaps the morie with the fly image can be minimised using a LAB scheme, as it separates colors from intensity.

However a 'linear light' version of the Intensity (L) channel may be helpful.
That is a sort of special linear-LAB colorspace.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
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 »

anthony wrote:
henrywho wrote:EWA Catrom, "Cub-grange" (cubic @ c=0.4846)
What is a Cub-grange filter? What makes it special? And why this name? Is it related to Lagrange in some way?
This is something Henry HO put together. If I understand, when the image is "natural", it mimicks the EWA Lagrange when downsampling. My guess is that it is

Code: Select all

convert {input} -filter Cubic -define filter:C=.4846 -distort Resize 20% {output}
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 »

@Anthony: Our eyes have different resolution with colour and intensity, so in principle it makes sense to do something different with each.
Whether this means applying the filter to linear intensity but not linear hue or whatever, or applying a different filter to each component, I don't know.
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 »

@Anthony:
Ginseng on the fly through LAB is a disaster: The eyes turn to rust.
Last edited by NicolasRobidoux on 2012-09-20T18:08:28-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 »

The backpack and the fly are "nightmare" test images for downsampling, which makes them very very good for this very reason :)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: best downsampling method for DSLR photographs

Post by anthony »

NicolasRobidoux wrote:@Anthony:
Ginseng on the fly through LAB is a disaster: The eyes turn to rust.
Perhaps without a perceptual Lightness. but a linear intensity?
Make need a bit of mix and matching of color channels from 'Gray' and 'Lab' L channel to get this right.

Just an idea, as a linear-LAB colorspace.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
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 »

@Anthony:
I understood, but I did not make clear that I understood.
And yes, I've not tried what you, specifically, suggest.
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 must say that, except for "special effects", I may have finally joined the "linear light only for downsampling" camp.
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 am also pretty close to bringing linear light -resize Mitchell near the top of the list when downsampling, with linear light EWA Robidoux close behind if one wants a bit more sharpness.
henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Re: best downsampling method for DSLR photographs

Post by henrywho »

The moire pattern of the Fly is my second concern.

My first concern is the change in overall brightness (i.e., de-focus my eyes and watch the compound eyes). Yet, unless we have a well-tuned monitor, it is impossible to detect judge whether there is any real brightness change.
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 »

@Henry:
This is why I may, at some point, use image difference metrics applied to the result of blurring the image slightly (like CMC 1:1).
But now, it's clear that moire is a problem, whether or not it affects the perceptual brightness.
Post Reply