Summary: improved EWA LanczosSharp with sigmoidization

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?".
Post Reply
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Summary: improved EWA LanczosSharp with sigmoidization

Post by NicolasRobidoux »

In viewtopic.php?f=1&t=21660, I discuss the use of a "sigmoidal" colourspace to reduce halo and blur when upsampling with the classical Lanczos (tensor Sinc-windowed Sinc) 3-lobe filter. In this post, I briefly discuss using sigmoidization with EWA (Elliptical Weighted Averaging) LanczosSharp, that is, Jinc-windowed Jinc 3-lobe with filter support scaled so that the first zero crossing is pretty much where it should be when the image is a 1D impulse (pixel-wide white column on a black background).
EWA LanczosSharp is a really good low pass filter. Not as sharp as orthogonal Lanczos, but "cleaner".
Unlike what I did with orthogonal Lanczos, I will use a possibly slightly "unsafe" contrast value, namely the one that gives an enlarged black square that stays within 2.3 JND of black, when the square is on a white background. With LanczosSharp, the corresponding contrast value is about 12.09375. (Maybe this value is slightly on the high side? This method is too new for me to know for sure.)
Code:

Code: Select all

magick INPUT.IMG -colorspace RGB +sigmoidal-contrast 12.09375 -filter Lanczossharp -distort Resize 400% -sigmoidal-contrast 12.09375 -colorspace sRGB OUTPUT.IMG
First, I'll repeat the four comparative tests based on http://www.wisdom.weizmann.ac.il/~visio ... ageSR.html. (Note that I have absolutely nothing to do with this site or the methods tested therein.) I'll also add an enlargement of text which I put together myself (with GIMP).
Last edited by NicolasRobidoux on 2012-08-24T05:23:25-07:00, edited 15 times in total.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Summary: improved EWA LanczosSharp with sigmoidization

Post by NicolasRobidoux »

First, the baby (a 4x enlargement):
Image
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Summary: improved EWA LanczosSharp with sigmoidization

Post by NicolasRobidoux »

Second, the man (a 4x enlargement):
Image
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Summary: improved EWA LanczosSharp with sigmoidization

Post by NicolasRobidoux »

The mother (a 4x enlargement):
Image
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Summary: improved EWA LanczosSharp with sigmoidization

Post by NicolasRobidoux »

Fourth, the chip (a 4x enlargement):
Image
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Summary: improved EWA LanczosSharp with sigmoidization

Post by NicolasRobidoux »

As with tensor Lanczos, adding more lobes (and correspondingly adjusting the (de)blur) can be used to add a bit of sharpness and decrease jaggies, at the expense of more haloing.
Instead of showing that, let me add an example of what this general purpose scheme does with text. Let's enlarge the following image 4x:
Image
Image
Pretty good for a general purpose scheme.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Summary: improved EWA LanczosSharp with sigmoidization

Post by NicolasRobidoux »

Let me add one more test image from http://www.wisdom.weizmann.ac.il/~visio ... ageSR.html. (I admit that choosing this particular one is cheating: Some subject matter is friendly to soft focus, and EWA LanczosSharp, sigmoidized or not, is definitely on the soft side.)
Image
This being said, download the above enlargement, and also download the SR one from the Weizmann Institute. Now, zoom in on the face and eyes with a "neutral" enlarger (like nip2). Or even Control-+ on your web browser a bunch of times.
Conclusion: Maybe there is a reason why the Weizmann site only shows enlargements by factors of 3 and 4.
(No need to tell me I'm biased. I know.)
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Summary: improved EWA LanczosSharp with sigmoidization

Post by NicolasRobidoux »

With EWA Lanczossharp, the "safer" contrast (that enlarges an image which is black on the left and white on the right to the same within 2.3 JND) is about 9.8323.
Last edited by NicolasRobidoux on 2012-08-30T12:54:17-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: Summary: improved EWA LanczosSharp with sigmoidization

Post by NicolasRobidoux »

Here is an 3x enlargement (of the firemen test image from the Weinzmann site) with the "safer" contrast:
Image
Using the higher value of the contrast raises acutance more. It looks good, but I like "safe".
P.S. Note that the original (that is being enlarged) was sharpened. Some of the halos seen in this enlargement are actually in the original.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Summary: improved EWA LanczosSharp with sigmoidization

Post by NicolasRobidoux »

Here are versions of the enlargements shown at viewtopic.php?f=22&t=21804 done with sigmoidized EWA LanczosSharp with the "safer" contrast value:
Image
Image
Image
Image
Image
Image
Image
Image
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Summary: improved EWA LanczosSharp with sigmoidization

Post by NicolasRobidoux »

With the "less safe" contrast value this time:
Image
Image
Image
Image
Image
Image
Image
Image
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Summary: improved EWA LanczosSharp with sigmoidization

Post by NicolasRobidoux »

With sigmoidization, it's really hard to tell that the above are results of applying a 3-lobe filter.
Post Reply