Page 7 of 16

Re: proper scaling of the Jinc filter for EWA use

Posted: 2012-01-01T14:15:38-07:00
by NicolasRobidoux
Also try http://www.imagemagick.org/Usage/images/shape_lines.gif:

Code: Select all

convert shape_lines.gif -define filter:filter=Jinc -define filter:window=Jinc -define filter:blur=0.943159799432847711 -define filter:lobes=4 -distort Resize 1600% JincJinc4blur4overr4.png
convert shape_lines.gif -define filter:filter=Sinc -define filter:window=Sinc -define filter:lobes=4 -resize 1600% oSincSinc4.png
convert shape_lines.gif -define filter:filter=Jinc -define filter:window=Jinc -define filter:blur=0.88451002338585141 -define filter:lobes=4 -distort Resize 1600% JincJinc4blur0p88451002338585141.png
convert shape_lines.gif -define filter:filter=Jinc -define filter:window=Jinc -define filter:blur=.9264075766146 -define filter:lobes=3 -distort Resize 1600% JincJinc3blur3overr3.png
convert shape_lines.gif -define filter:filter=Sinc -define filter:window=Sinc -define filter:lobes=3 -resize 1600% oSincSinc3.png
convert shape_lines.gif -define filter:filter=Jinc -define filter:window=Jinc -define filter:blur=0.88549061701764 -define filter:lobes=3 -distort Resize 1600% JincJinc3blur0p88549061701764.png
For this one, it's no contest: sharpened EWA wins. Although, and this should be no surprise to Imaggie, 3-lobe is best.

Re: proper scaling of the Jinc filter for EWA use

Posted: 2012-01-01T15:41:39-07:00
by NicolasRobidoux
@Imaggie: Please feel free to contradict me: I'm trying to make the best design decisions, irregardless of where the "evidence" comes from.

Re: proper scaling of the Jinc filter for EWA use

Posted: 2012-01-01T17:51:10-07:00
by NicolasRobidoux
This last test gave me an idea of another thing to optimize by "blur"ing: MInimize the depth of the "light" halo ("bounceback") of Jinc-windowed Jinc 3 and 4 which arises from upsampling a white 1-pixel wide line on a black background. P.S. This is a more complex optimization to perform exactly.

Re: proper scaling of the Jinc filter for EWA use

Posted: 2012-01-02T00:00:09-07:00
by imaggie
Image

could I suggest you take a look at this as a test image. While not a block graphic, it does have high contrast edges and sharp diagonals which are useful picking up some defects in various filters.

I just ran the following three rescalings:

Code: Select all

convert cameraman.png -define filter:filter=Sinc -define filter:window=Sinc -define filter:lobes=4\
 -distort Resize 300% ewaSincSinc4.png

convert cameraman.png -define filter:filter=Sinc -define filter:window=Sinc -define filter:lobes=4\
 -resize 300% oSincSinc4.png

convert cameraman.png -define filter:filter=Sinc -define filter:window=Sinc -define filter:lobes=3\  
 -resize 300% oSincSinc3.png
EWA sinc4 loses by a mile. This does not surprise me because sinc is probably not the correct function to use, other than in the orthogonal case.

oSinc3 is marginally better than oSinc4 which tends show slightly more defects : see neck, camera lens, tripod tilt mechanism, ghosting over shoulder.

The differences are subtle but I put oSinc3 ahead of oSinc4 by a nose. This is in agreement with what I found doing Lanczos in gimp.


Similarly doing -distort Resize with jinc3 and jinc4 the ringing is slightly more pronounced on J4.

Code: Select all

convert cameraman.png -define filter:filter=Jinc -define filter:window=Jinc -define filter:lobes=3\
 -distort Resize 300% JincJinc3.png

convert cameraman.png -define filter:filter=Jinc -define filter:window=Jinc -define filter:lobes=4\
 -distort Resize 300% JincJinc4.png
Again, it's marginal but despite a general appearance of being slightly sharper this is due to increased ringing adding contrast to edges (interesting analogy to unsharp mask) . Closer inspection shows more pronounced ghosting on camera lens, back of head and tripod legs and rougher features on face.

This image confirms EWA dealing better with diagonals than orthogonal and this has a positive effect on the image in general , removing some roughness from the features of the subject.

Re: proper scaling of the Jinc filter for EWA use

Posted: 2012-01-02T07:26:32-07:00
by NicolasRobidoux
imaggie wrote:...
oSinc3 is marginally better than oSinc4 which tends show slightly more defects : see neck, camera lens, tripod tilt mechanism, ghosting over shoulder.

The differences are subtle but I put oSinc3 ahead of oSinc4 by a nose. This is in agreement with what I found doing Lanczos in gimp.


Similarly doing -distort Resize with jinc3 and jinc4 the ringing is slightly more pronounced on J4.
...
Funny enough, before reading your email, I had figured that 3-lobe is probably better than 4-lobe because when 4-lobe artifacts are noticeable, they are very much so.

I'll run this (famous) test image through the sharpened ones when I have a minute.

Re: proper scaling of the Jinc filter for EWA use

Posted: 2012-01-02T08:20:40-07:00
by NicolasRobidoux
The whole enchilada:

Code: Select all

convert cameraman.png -define filter:filter=Jinc -define filter:window=Jinc -define filter:blur=0.943159799432847711 -define filter:lobes=4 -distort Resize 1600% \
JincJinc4blur4overr4.png
convert cameraman.png -define filter:filter=Sinc -define filter:window=Sinc -define filter:lobes=4 -resize 1600% \
oSincSinc4.png
convert cameraman.png -define filter:filter=Jinc -define filter:window=Jinc -define filter:blur=0.88451002338585141 -define filter:lobes=4 -distort Resize 1600% \
JincJinc4blur0p88451002338585141.png
convert cameraman.png -define filter:filter=Jinc -define filter:window=Jinc -define filter:blur=.9264075766146 -define filter:lobes=3 -distort Resize 1600% \
JincJinc3blur3overr3.png
convert cameraman.png -define filter:filter=Sinc -define filter:window=Sinc -define filter:lobes=3 -resize 1600% \
oSincSinc3.png
convert cameraman.png -define filter:filter=Jinc -define filter:window=Jinc -define filter:blur=0.88549061701764 -define filter:lobes=3 -distort Resize 1600% \
JincJinc3blur0p88549061701764.png

Re: proper scaling of the Jinc filter for EWA use

Posted: 2012-01-02T09:24:40-07:00
by imaggie
Well, blur=0.943159799432847711 is a tad sharper with all that that implies. More jaggies on tripod, sharper look overall, slightly more intense look of concentration for the cameraman.

I think the most accurate is a straight jinc3 without the deblur. With blur=0.88549061701764 I see a bit of roughness in the face that seems artificial.

Another test I think is important is a female portrait. These are horrendously intolerant of sharpening that quickly makes a beautiful face look decidedly disease ridden. Subtle flesh tones get spots and the result is not pretty.

I just did a quick check on such an image and straight j3 looks good (without looking for a misty softness, it looks accurate) , however with deblur factor it starts to look unflattering. I don't have a public domain image to post but such an example would be easy to find. ( I'd defavour the equally famous "Lena" since it is too soft to start with ).

I suspect at this level it's a case of horses for courses and that there is not an objective "best" that applies to all types of image.

Re: proper scaling of the Jinc filter for EWA use

Posted: 2012-01-02T11:09:54-07:00
by NicolasRobidoux
Imaggie: If I try to boil down your comments and mix with my own preferences, it appears that EWA LanczosSharp (in the current or "improved" version discussed in http://imagemagick.org/discourse-server ... =60#p79475 that would be the "all-purpose winner" over the maximally or "balanced" sharpened ones:

Code: Select all

convert original.* -filter LanczosSharp -distort resize 1600% LanczosSharp.png
(current) or

Code: Select all

convert original.* -define filter:filter=Jinc -define filter:window=Jinc -define filter:blur=0.9891028367558475 -define filter:lobes=3 -distort resize 1600% newLanczosSharp.png
("improved").

Re: proper scaling of the Jinc filter for EWA use

Posted: 2012-01-02T13:21:48-07:00
by fmw42
You might find some suitable face image or other test images at the external links section of http://en.wikipedia.org/wiki/Standard_test_image

Re: proper scaling of the Jinc filter for EWA use

Posted: 2012-01-02T13:53:20-07:00
by NicolasRobidoux
@fmw42: Thank you Fred, as always.

Re: proper scaling of the Jinc filter for EWA use

Posted: 2012-01-02T14:11:23-07:00
by fmw42
This was posted some time ago on the forum and I have used it for examples, but I cannot say for sure if it is license free. But it might help for a start.

Image

Re: proper scaling of the Jinc filter for EWA use

Posted: 2012-01-02T23:58:41-07:00
by imaggie
the Kodac suite (24bit PNG) http://r0k.us/graphics/kodak/ has a girl in red hat that looks suitable. Preamble says images are "for unrestricted usage".

Image

Between the smooth flesh tones and freckles that should some provide fairly exacting tests.

Re: proper scaling of the Jinc filter for EWA use

Posted: 2012-01-03T00:04:26-07:00
by imaggie
Of course, it was right in front of me all the time !

Why don't we use some of the russian tarts that adorn my screen every time I visit this forum ??? :lol:

Re: proper scaling of the Jinc filter for EWA use

Posted: 2012-01-03T05:45:36-07:00
by NicolasRobidoux
I gave a spin to freckles.jpg (only at 400% because it is already quite large), and showed the results to my wife. We both agree that the sharpened EWA 3-lobes are sharper, but that the new EWA LanczosSharp (essentially same as the current LanczosSharp as well as the current EWA Lanczos) avoid slightly off-colour spottiness under the eyes. So, imaggie's prognostic seems to hold.

Re: proper scaling of the Jinc filter for EWA use

Posted: 2012-01-03T05:46:41-07:00
by NicolasRobidoux
The differences are subtle, though, I think it may be worth it to pass things through a gamma-corrected toolchain (and a calibrated monitor).