Re: 'Magic' kernel for image zoom resampling?



aruzinsky wrote:
Again, you lost me here. Please, stop belaboring everything else and
explain only the above. Since your kernel is separable, you should be able
to give a 1D example to explain your enlargement process.

Good idea. Sorry.

Take the original 1-d 'image' to be

a b c d e ...

and the enlarged image to be

A B C D E F G ...

Ignore edge effects, and put b half-way between A and B, c half-way
between C and D, d half-way between D and E, etc. Then

A = ( a + 3b ) / 4
B = ( 3b + c ) / 4
C = ( b + 3c ) / 4
D = ( 3c + d ) / 4
E = ( c + 3d ) / 4
F = ( 3d + e ) / 4
G = ( d + 3e ) / 4

etc. You can see, for example, that 'c' contributes {1,3,3,1} / 4 to
{B,C,D,E}; 'd' contributes {1,3,3,1} / 4 to {D,E,F,G}; and so on.

To downsample from the A B C ... back to the a b c ... you just apply
this in reverse:

c = ( B + 3C + 3D + E ) / 8
d = ( D + 3E + 3F + G ) / 8

etc.

In the general case of m=2^k, where the block filter would just choose
the nearest tile of m pixels, the algorithm actually chooses the center
tile of m pixels, plus the tile of m pixels to the left, plus the tile
of m pixels to the right. The left and right tiles grow parabolically
from 0 at the edges (that's why the kernel is of width 3m-2 rather than
3m, because the ends always vanish), and the center tile is an inverted
parabola of twice the curvature. Every pixel in the enlarged image
receives contributions from three original pixels; the two end
parabolas plus the middle parabola add up to unity, for every position.

For example, for m=4, the kernel is

0 1 3 6|10 12 12 10|6 3 1 0

and if you add up the three parabolas, you get
{0,1,3,6}
+{10,12,12,10}
+{6,3,1,0}
={16,16,16,16}.

In this case (again ignoring edge problems) you get

A = ( 6a + 10b + 0c ) / 16
B = ( 3a + 12b + 1c ) / 16
C = ( 1a + 12b + 3c ) / 16
D = ( 0a + 10b + 6c ) / 16

E = ( 6b + 10c + 0d ) / 16
F = ( 3b + 12c + 1d ) / 16
G = ( 1b + 12c + 3d ) / 16
H = ( 0b + 10c + 6d ) / 16

etc.

To downsample, you reverse the process, so that

c = ( 0A + 1B + 3C + 6D + 10E + 12F + 12G + 10H + 6I + 3J + 1K +0L ) /
64

etc.

Does this make more sense now?

Apologies again for being unclear,
John

.



Relevant Pages

  • Re: Alternatives to QImage?
    ... > So it sounds like just enlarging the print gives you larger dots, ... The most basic method of enlargement, pixel doubling, replaces ... fill part of each 'step' in the jagged line with pixels that are the same ... use to make the colour transitions in all directions reflect the original ...
    (comp.periphs.printers)
  • Re: ANNOUNCE: Multi-column listbox package Tablelist 4.1
    ... I have just posted a detailed analysis of the appearance problem on Mac ... In my old mclistbox code I set bindings on the label widgets that represent the headers. ... Combined with the fact the headers had no space between them made it possible to click exactly in the middle or one or two pixels to either side. ... appearance problem on the Mac when using newer tile versions. ...
    (comp.lang.tcl)
  • Re: Non-interpolated size of the 300d sensor - PPI
    ... The native resolution of the 300d/Rebel is 3072x2048 pixels. ... But as said that is only an enlargement specification and this is not ... You can also try to figure it with a chemical analogy: ... The dpi/ppi setting is the enlargement ratio: ...
    (rec.photo.digital)
  • Re: Improving the quality of a blocky image
    ... I didn't produce any box enlargement. ... the pixels in each of ... Then that reduced image was enlarged by my proprietary method ... which incorporates prior knowledge that the image was a box reduction. ...
    (sci.image.processing)
  • Re: Image enlargement software
    ... but after giving it a try I'm not that impressed (fail to see visible improvements over a simple bicubic interpolation enlargement). ... All you can really get is interpolated pixels that make a smooth image. ... Experimenting with different interpolation methods will give you some experience. ... I use Paint Shop Pro, which offers several interpolation methods that I can apply to an image, and choose the one I like best for that image. ...
    (rec.photo.digital)