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 »

henrywho wrote:...
=> EWA/QuadraticJinc/USM does a wonderful job, giving nice perceived sharpness without (or with minimal) moire patterns.
=> EWA/Lagrange and EWA/Lanczos4/blur=0.8 closely follow, with slight moire patterns.
...
This, in particular, is interesting.
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 »

henrywho wrote:BTW, I think USM should be done under Linear RGB otherwise it will greatly affect the overall brightness of some feature patterns
From a "theoretical viewpoint", I agree.
The rule of thumb is: If you convolve, do it in linear light. USM is a convolution.
I'm not sure the rule of thumb is universal. But it is a good starting point.
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:
henrywho wrote:BTW, I think USM should be done under Linear RGB otherwise it will greatly affect the overall brightness of some feature patterns
From a "theoretical viewpoint", I agree.
I've compared
[1] rgb -> resize -> usm -> srgb
[2] rgb -> resize -> srgb -> usm
[3] resize -> usm

[1] looks most "correct" for backpack.... having the most similar brightness as the original.
Perhaps XYZ would look good too?
henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Re: best downsampling method for DSLR photographs

Post by henrywho »

This test case demonstrates another "feature" of USM: It enhances the "3D" look of the grass. EWA/Catrom and EWA/Lagrange can also simulate this effect. EWA/LanczosN/blur=0.8 cannot.
I should say .... a higher contrast on the grass area.
henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Re: best downsampling method for DSLR photographs

Post by henrywho »

As USM is also pushing values to the extreme, will it benefit from HDRI too?
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 »

Possibly HDRI would improve USM. I think it may be a two pass convolve. Not certain.
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 »

New ideas (not mine) that give impressive results: http://forum.doom9.org/showthread.php?p ... ost1597477
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: best downsampling method for DSLR photographs

Post by fmw42 »

Any idea or references to how anti-ringing works? I presume it is post-processing?
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 »

madVR's AR (AntiRing) is proprietary and a loose "trade secret" of Mathias Rauen, the developer. It is an evolved version of what's discussed here: http://forum.doom9.org/showthread.php?t=145358. Mathias Rauen = madshi.
There is something apparently related that was built into the Intel SandyBridge chip by Eric Gur, the main developer of the Intel QuickSync Decoder: http://forum.doom9.org/showthread.php?t=162442. Another trade secret. Not so loose. Eric Gur = egur.
User avatar
RitterRunkel
Posts: 7
Joined: 2013-09-17T05:12:16-07:00
Authentication code: 6789
Location: Germany

Re: best downsampling method for DSLR photographs

Post by RitterRunkel »

Hello and thx for all the knowledge so far! I've got three questions:

1. Any news on best downsampling methods for photographs, and what exactly (which algorithm) is lohalo and nohalo, coming up in gimp? There seems to be no lohalo/nohalo-equivalent in ImageMagick, or is there?

2. I'm quite happy with Catrom for very sharp downsampling of photographs not prone to moiré, EWA Lanczos3Sharpest for usual downsampling and EWA quadratic B-spline-windowed Jinc 3 in hard cases being prone to moiré. But I did some tests and I wonder about this (though less photographic) test case with downsampling to 50 or 33%: Test image. What would be an ideal algorithm to retain the natural impression (mainly grey gradients)? My results look like this: 33% downsampled.

3. Almost all methods deliver RGB-color and the complementary colors as well (as seen in the downsampled pic). Seems, light grey + R -> R, but dark grey + R -> Cyan. This is the opposite of my personal impression! Would be happy to know why this is and how to avoid it ...

Thank you and kind regards,
Robin
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: best downsampling method for DSLR photographs

Post by snibgo »

Some non-photographic images are better downsampled in RGB space, rather than the default sRGB space:

Code: Select all

convert -colorspace RGB "2.20+Gamma+Calibration.png" -resize 33% -colorspace sRGB r.png
I don't know which filter might be better.

For algorithms "coming up in Gimp", you might ask in a Gimp forum.

EDIT: Sorry, I mis-typed that command. It should be:

Code: Select all

convert "2.20+Gamma+Calibration.png" -colorspace RGB -resize 33% -colorspace sRGB r.png
Last edited by snibgo on 2013-09-17T07:51:59-07:00, edited 1 time in total.
snibgo's IM pages: im.snibgo.com
User avatar
RitterRunkel
Posts: 7
Joined: 2013-09-17T05:12:16-07:00
Authentication code: 6789
Location: Germany

Re: best downsampling method for DSLR photographs

Post by RitterRunkel »

snibgo wrote:Some non-photographic images are better downsampled in RGB space, rather than the default sRGB space
Already did that ... but tried your code, too, and all was fine, so I quickly figured out, what was wrong in my code. In my testing sigmoidal contrasting was left:

Code: Select all

convert x.png -colorspace RGB +sigmoidal-contrast 4,50% -filter Catrom -distort resize 33% -sigmoidal-contrast 4,50% -colorspace sRGB y.png
Sorry, would have been smarter to post my code here next to my question. So it's fine, I just have to figure out, when this sigmoidal-contrast makes sense. I read about using it to retain color otherwise lost during resizing. And it did ... somehow. ^^ But with 50% strange colors ...
snibgo wrote:For algorithms "coming up in Gimp", you might ask in a Gimp forum.
Oh, you're right for sure, but I thought some of the well known guys here are engaged in both developments ...

Thx for the reply!


So I'm able to retain color, depending on the strength of contrasting. But it would be very nice, if someone could describe how I can avoid this color switch at 50% of the gradient ... is there a way to get slight color without switching and maybe homogenous from top to bottom (other possibility than sigmoidal?)?
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: best downsampling method for DSLR photographs

Post by holden »

OT, but I just checked on this the other day:
http://libregraphicsworld.org/blog/entr ... rowdfunded

http://freedomsponsors.org/core/issue/7 ... arp-images

I've heard that downsizing in no more than 50% increments at a time helps, even sharpening at each level, but that would be up for experimentation IMO.
User avatar
RitterRunkel
Posts: 7
Joined: 2013-09-17T05:12:16-07:00
Authentication code: 6789
Location: Germany

Re: best downsampling method for DSLR photographs

Post by RitterRunkel »

holden wrote:I've heard that downsizing in no more than 50% increments at a time helps, even sharpening at each level, but that would be up for experimentation IMO.
Tried it, but didn't help. Think that stepwise resizing is meant to be helpful in sharpness and detail. But my problem is more color than luminance/moiré ... I'm able to produce homogenous gradients now, but colorless and grey. I'd like to retain slight color, at the moment by using sigmoidal contrast, but color switches from magenta to green, for example. Always in the middle: less magenta -> green, more magenta -> magenta. And this is the same for 60%: 60% resampled.

Interesting crowdfunding, thx for the hint! Would love to see more methods, either in gimp or in ImageMagick!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: best downsampling method for DSLR photographs

Post by snibgo »

From this thread and viewtopic.php?f=22&t=21415, it seems sigmoidal processing is suggested to reduce halos when enlarging, and not for reducing.
snibgo's IM pages: im.snibgo.com
Post Reply