MNG MAGN methods
This illustrates the two methods used in the MAGN proposal and an
alternate methods using ImageMagick's method and L1 splines.

Method 1
Pixel Replication
|

Method 2
Linear Interpolation
|

Alternate 2
ImageMagick's Interpolation
|

Alternate 2
L1 Spline Interpolation
|
All three images originated from this 5x5 pgm file:
P2 5 5 1
0 0 0 0 0
0 0 0 0 0
0 0 1 0 0
0 0 0 0 0
0 0 0 0 0
It is a single white pixel in the middle of a black 5x5 array.
-
To emulate Method 1 (pixel magnification), I used ImageMagick's
convert -sample 33x33 5x5.pgm 33x33.pgm.
This magnified the pixels 8x by pixel replication. The "-sample"
method in ImageMagick uses the closest pixel, so the blocks are
centered over the original pixels, not offset to the right and
bottom as in the MAGN proposal [should the proposal be revised
to do this?]
Then I expanded the image another 8x for visbility, using
convert -sample 264x264 33x33s.pgm 264x264s.pgm
The simple magnification resulted in
a sharp blocky image, as shown on the left.
-
Method 2, linear interpretation is demonstrated by magnifying the
5x5 image using a
"pmninterp" script provided by Adam Costello. It didn't properly
scale the value "1" to full scale, so I edited the 5x5.pgm and
changed the two "1" values to "255", then
pmninterp 8 < p255_5x5.pgm > 40x40i.pgm
then
convert -sample 320x320 40x40s.pgm 320x320i.pgm
and converted that to jpeg for use on this page.
-
At first, to emulate Method 2 (linear interpolation, or "lerping"), I
had used ImageMagick's
convert -geom 33x33 5x5.pgm 33x33g.pgm.
This magnified the intervals 8x
approximately if not exactly by linear magnification.
Then, as above, I expanded the image another 8x for visibility, using
convert -sample 264x264 33x33g.pgm 264x264g.pgm
The linear magnification resulted in
a soft blurry image, as shown in the middle.
It seems, however, that this is not linear interpolation, as I first thought.
-
To emulate an alternate method (L1 splines), I used a research code provided
by John Lavery, to produce a 33x33 interpolation of the original 5x5
image. This magnified the intervals 8x by L1 spline interpolation.
Then, as above, I expanded the image another 8x for visibility, using
convert -sample 264x264 33x33L.pgm 264x264L.pgm
The linear magnification resulted in another
soft blurry image, as shown on the right.
Finally, I cropped away some of the uninteresting black area from each image,
and converted the results to JPEG to make the three 180x180 images that
appear in the table, above.
|