"Sigmoidal" minimization of resampling filter haloing & blur

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
Post Reply
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: "Sigmoidal" minimization of resampling filter haloing

Post by NicolasRobidoux »

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

Re: "Sigmoidal" minimization of resampling filter haloing

Post by NicolasRobidoux »

For orthogonal Lanczos (3-lobe), the contrast that satisfies the criterion is just under 19.22396. Which, I must say, is in the neighbourhood I like according to the "eyeball metric".
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: "Sigmoidal" minimization of resampling filter haloing

Post by NicolasRobidoux »

Henry: I'll have to redo the downsampling tests with the newly fixed sigmoidal-contrast code. (IM7 is closest to fixed, and the fix is not complete for orthogonal resize methods with negative lobes.) Other things to do for a while.
henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Re: "Sigmoidal" minimization of resampling filter haloing

Post by henrywho »

NicolasRobidoux wrote:Henry: I'll have to redo the downsampling tests with the newly fixed sigmoidal-contrast code. (IM7 is closest to fixed, and the fix is not complete for orthogonal resize methods with negative lobes.) Other things to do for a while.
Remember to include this test case: http://www.4p8.com/eric.brasseur/gamma_ ... a_gray.zip :D
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: "Sigmoidal" minimization of resampling filter haloing

Post by NicolasRobidoux »

Henry: "Brasseur test" conclusion: stick to linear light when downsampling.
henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Re: "Sigmoidal" minimization of resampling filter haloing

Post by henrywho »

NicolasRobidoux wrote:Henry: "Brasseur test" conclusion: stick to linear light when downsampling.
Seems LUV works very well in Brasseur-Dalai test:

Code: Select all

convert gamma_dalai_lama_gray_tft.jpg -distort resize 50% -quality 95% -sampling-factor 1:1:1 dal_tft.jpg
convert gamma_dalai_lama_gray_tft.jpg -set colorspace sRGB -colorspace RGB -distort resize 50% -colorspace sRGB -quality 95% -sampling-factor 1:1:1 dal_tft_rgb.jpg
convert gamma_dalai_lama_gray_tft.jpg -set colorspace sRGB -colorspace LUV -distort resize 50% -colorspace sRGB -quality 95% -sampling-factor 1:1:1 dal_tft_luv.jpg
convert gamma_dalai_lama_gray_tft.jpg -set colorspace sRGB -colorspace LAB -distort resize 50% -colorspace sRGB -quality 95% -sampling-factor 1:1:1 dal_tft_lab.jpg
But it does not work that well in Brasseur-SR test: http://www.4p8.com/eric.brasseur/gamma-1.0-or-2.2.png
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: "Sigmoidal" minimization of resampling filter haloing &

Post by NicolasRobidoux »

Henry: Thank you.
-----
I wonder how much these contrived tests really tell us.
henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Re: "Sigmoidal" minimization of resampling filter haloing &

Post by henrywho »

NicolasRobidoux wrote:I wonder how much these contrived tests really tell us.
Sorry being off-topic. Actually I should have posted in another thread where Anthony talks about LAB and LUV.

Even if they are too harsh sometimes, these contrived tests do help revealing abnormality. For example, the LUV-downsize above produces color dots (ring) and blue strip (SR). I guess there are some problems in the LUV codes.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: "Sigmoidal" minimization of resampling filter haloing &

Post by NicolasRobidoux »

Henry: No apologies please. I truly appreciate.
My "contrived" musing has to do with the "Brasseur" tests, not yours.
It's just that there are all sorts of artifacts that show up when resampling, and I wonder if these particular ones truly are so important. (I do think they are, but I nonetheless wonder.)
-----
I am convinced that linear light is "it" when downsampling. But I am not certain.
henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Re: "Sigmoidal" minimization of resampling filter haloing &

Post by henrywho »

NicolasRobidoux wrote:I am convinced that linear light is "it" when downsampling. But I am not certain.
Me neither, especially after Anthony's comment that while linear RGB's intensity is linear, its colors are not.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: "Sigmoidal" minimization of resampling filter haloing &

Post by NicolasRobidoux »

Tensor (orthogonal) Cosine and Welch (spelled Welsh in IM) windowed Sincs work really well with sigmoidization (only checked 3 lobes). They could be better than Lanczos 3.
P.S. Tensor Jinc-windowed Sinc is also good. (!)
Last edited by NicolasRobidoux on 2012-08-13T12:58:48-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: "Sigmoidal" minimization of resampling filter haloing &

Post by fmw42 »

They could be better than Lanczos 3.
Are you saying that you tried Lanczos 3 and find it not doing so well or that you suspect that Lanczos 3 might work better than the other two windows?
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: "Sigmoidal" minimization of resampling filter haloing &

Post by NicolasRobidoux »

What I'm saying is that, since sigmoidization takes care of overbearing halos, I can use less dampening windowing functions than Sinc (which gives Lanczos), like Cosine, Welch and Jinc. Using a window function that does not decay as fast when approaching 1 means that I'm using something which is "closer" to unwindowed Sinc. It looks like the latter (Cosine-, Welch- and Jinc-windowed Sinc) work better than the former (Lanczos = Sinc-windowed Sinc). But this is, of course, very preliminary. And I only looked at 3-lobe, for example

Code: Select all

magick input_small.png -set colorspace sRGB -colorspace RGB +sigmoidal-contrast 25,50% -define filter:filter=Sinc -define filter:window=Jinc -resize 1600% -sigmoidal-contrast 25,50% -colorspace sRGB oSincJinc3.25.png
Clearer?
P.S. Even though there is no theoretical reason for this being good, windowing orthogonal Sinc with Jinc really seems to work well. It's slightly less jaggy, but I can't see more haloing (in my limited tests). Cosine- and Welch-windowed Sincs are also less jaggy, but they are more halo-y.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: "Sigmoidal" minimization of resampling filter haloing &

Post by NicolasRobidoux »

Warning: The differences will not jump at you. In the "chip" test image, it's the letter P that tells the most obvious story.
Also: I did not try Cosine and Welch at random: They rank above Lanczos in Adam's reconstruction tests.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: "Sigmoidal" minimization of resampling filter haloing &

Post by fmw42 »

Clearer?
Yes, thanks. I believe that you are saying that you tried Lanczos 3 and believe the Welch and Cosine may be a bit better. Is that correct?
Post Reply