Page 1 of 1

EWA Filters with a hash pattern

Posted: 2013-02-13T17:52:56-07:00
by anthony
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

Re: EWA Filters with a hash pattern

Posted: 2013-02-14T10:55:14-07:00
by NicolasRobidoux
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!

Re: EWA Filters with a hash pattern

Posted: 2013-02-14T20:28:57-07:00
by anthony
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

Re: EWA Filters with a hash pattern

Posted: 2013-02-16T07:00:58-07:00
by NicolasRobidoux
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.