Extensive changes to image subtraction codes. Discovered that I
wasn't (again) implementing the algorithm correctly --- I was
accumulating
sum_x,y C_i(x,y) sum_x,y C_j(x,y)
instead of
sum_x,y C_i(x,y) C_j(x,y)
i.e., I was doing the sums separately. I'm amazed that it was
actually getting fairly decent results before, but now it's doing it
properly. As part of this fix, added in, for each stamp, images
corresponding to the convolution of the reference with each of the
kernel components. This allows fast rejection (instead of generating
the kernel and convolving, can simply sum the individual convolutions
with the correct scaling).
Added use of FFT to do convolutions. This involved changing around
the convolvePixel function (now convolveRef, since it generates the
entire image for the convolution of the reference stamp with a kernel
component, rather than a single pixel as previously). Tested with
POIS and ISIS kernels, but no others yet. FFT is nice and fast for
the large (size = 10) kernels I've been using, so I also moved it in
to the convolveRef function for appropriate kernel types.
As part of the FFT move, discovered that my convolutions were around
the wrong way --- supposed to be convolved = image[y][x] * conv[y - v][x - u]
instead of conv[y + v][x + u]. However, this problem didn't manifest
itself previously because everything was consistently around the wrong
way. The FFT does it the Correct Way, so it revealed the problem. This
is now fixed throughout the image subtraction code.