I'm trying to speed up a convolution of a 3D image with a Gaussian kernel by using fftn() and ifftn() as convn() appears to be unacceptably slow...
It sort of works, but I cannot get my new code to exactly reproduce the results of the current code that uses convn.
I have distilled the differences down to the test program below -- my gut feeling is that only the kernel needs adjusting and then the fftn convolution should produce the same result as the convn version -- and quite a bit faster!
The program does not need toolboxes. The matlab command "[a,b]=gauss_filter_test;" should give the convn-result in variable a and the fftn result in variable b.
Does anyone see what the problem is? Am I mixing up shifts, conjugates? Does it need twice the #samples?
Many thanks Alle Meije
<code> function [ filtered, filtered2 ] = gauss_filter_test;