EWA Filters with a hash pattern

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
Post Reply
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

EWA Filters with a hash pattern

Post by anthony » 2013-02-13T17:52:56-07:00

Finally added a example of the Jinc functions property to remove a hash pattern.
http://www.imagemagick.org/Usage/filter/#distort_noop

Code: Select all

   convert -size 100x100 pattern:gray50  hash.png
   convert hash.png -filter Lanczos -distort resize 100% hash_removed.png
Image -> Image
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: EWA Filters with a hash pattern

Post by NicolasRobidoux » 2013-02-14T10:55:14-07:00

Indeed, the hash pattern is pretty much gone:
From 255 and 0, white goes to 129 and black to 126 with plain EWA Lanczos.
With the variant of LanczosSharp I most recommend it's 131 and 124.
With plain vanilla LanczosSharp it's 133 and 122.
With LanczosRadius it's 151 and 104.
With LanczosSharpest it's 174 and 81.
-----
Stripes, however, are not damped as much.
Doing the same to the output of

Code: Select all

convert -size 100x1 pattern:gray50 -scale 100x100\! stripes.png
one has that
With plain EWA Lanczos, white goes to 245 and black to 10.
With the variant of LanczosSharp I most recommend it's 249 and 6.
With plain vanilla LanczosSharp it's 253 and 2.
With LanczosRadius it's 255 and 0.
With LanczosSharpest it's also 255 and 0.
-----
I actually believe that this combination of strong damping of the checkerboard mode combined with very very mild damping of the stripes mode has a lot to do with why they look good!

User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: EWA Filters with a hash pattern

Post by anthony » 2013-02-14T20:28:57-07:00

ASIDE; moving to a new thread


This was just updating an example of something I noted when I first studied Jinc.

It was a demonstartion of just what Jinc is attempting to do in 2 dimensions, to what Sinc does in one dimension. But as a result fails completely for a hash pattern.

That is at a no-op or unity scaling, all neighbours make no contribution to the result, only the original primary pixel value.

Sinc does this perfectly as all neighbours in 1 Dimention are stricty at integer spacings.
Jinc however tried to fudge this but adding diagonal neighbours and subtracting orthogonal neighbours about equally (well over a infinite distance). Of course a windowed version will fail (it isn't infinite). But a hash pattern completely messes this up and effectivally destorys that effort.


What I have not exampled (an many never example) is what happens when you miss-use Sinc as a 2-dimentional filter, using specific numbers of lobes. In that case a hash pattern not only cancles any attempt to get a good color, it completely crazy and generates effectively infinite positive and negative colors! As the weighted sum divisor like to go to zero! The result after clipping is a pattern of pure black and white pixels.

Using Sinc (or windowed sinc) filters directly as a 2-dimentional filter was a mistake on my part when I first started to try and convert 'tensor' filters into EWA or 2 dimenstional filters. The results were as I said crazy. But now I like to explore that crazness and see what interesting "mis-uses" I can find. :D
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: EWA Filters with a hash pattern

Post by NicolasRobidoux » 2013-02-16T07:00:58-07:00

Anthony:
One theorem and two corollaries found in the "Interpolation Conflicts with Strong Diagonal Preservation" subsection of my student Chantal Racette's Masters thesis are relevant to this issue. See section 3.5.3 of http://arxiv.org/abs/1204.4734. (I'm the author of the theorem and corollaries, but they went into her thesis because they justify her efforts.)
As the section title says, if a scheme (linear or nonlinear) is interpolatory (which implies that it perfectly preserves hash patterns, actually any image, under no-op, although being interpolatory is a stronger condition because it does not only apply to no-op), then it cannot come close to doing a decent job with diagonal features.
And vice versa: If a scheme does a perfect job at preserving diagonal features, it can't be interpolatory.
This does not mean that one can't get something which is pretty good at preserving diagonal features and pretty close to being interpolatory. But if one is achieved perfectly, the other can't. And in general, the more of the one, the less of the other.
For example:
Tensor Lanczos 3 (interpolatory) -> sharp diagonal lines have a lot of staircasing when enlarged. (The staircasing takes the form of small hash pattern echos.)
EWA LanczosSharp 3 (not interpolatory) -> not so much, but results are generally blurrier.
In summary: The zero sum game between blurriness and jagginess is really hard to escape.
Mitchell-Netravali and EWA LanczosSharp are well-liked because they are good compromises between the two.

Post Reply