Date: Mon, 11 Nov 1996 17:30:57 GMT Server: NCSA/1.5 Content-type: text/html Last-modified: Mon, 23 Oct 1995 20:29:37 GMT Content-length: 4603
tmp = 0 for m = -2 to 2 for n = -2 to 2 tmp = tmp + w(m,n) * image((row+m)/2, (col+n)/2) store tmp
instead of a "correct" version like:
tmp = 0 for m = -2 to 2 for n = -2 to 2 if (row+m mod 2 = 0 and col+n mod 2 = 0) then tmp = tmp + w(m,n) * image((row+m)/2, (col+n)/2) store 4*tmp
In the correct version, suppose row and column are both even, say 10.
Then you actually use a 3x3 window on the input image [row values: (10-2)/2,
10/2, (10+2)/2 and column values (10-2)/2, 10/2 and (10+2)/2]. Thus only nine
of the 25 weights in the kernel are used corresponding to the x's below:
x o x o x o o o o o x o x o x o o o o o x o x o xand if you consider the weights of those nine locations, they turn out to be:
.0025 .0200 .0025 .0200 .1600 .0200 .0025 .0200 .0025summing up to 0.25 exactly. And thus you should multiply your result by 4 so that the effective sum of weights is 1.
In the incorrect version (still assuming row and column to be even), you are
effectively truncating (row+m)/2, (col+n)/2 for m,n = -2..2. For instance the
computed row index is same for m = 0 and m = 1 [row/2 = (row+1)/2]. Thus you
are still using a 3x3 window on your input image, but some values in this
window are repeated. The effective weights for the window are:
.0900 .1950 .0150 .1950 .4225 .0325 .0150 .0325 .0025summing up to 1.0. This weight window is obviously very different from Burt-Adelson's weights. For row odd, column even etc, you can similarly compute the effective weight matrices and see that the results are not similar for the two algorithms.
The "correct" version tries to interpolate pixel values in the larger (output) image by looking at a neighborhood in the smaller (input) image. It makes sense to use a symmetric Gaussian-like weight matrix to do that.