I have a certain 2-D function. More properly, I have not the function itself, but the matrices $[X,Y,Z]$, where $X,Y$ are $1\times n$, and $Z$ is $n \times n$.
Now, I want to calculate a a new matrix, $\hat Z$, whose value at each point is the average of $Z$-values from a small region around that point. In other words, $\hat Z(p) = \frac{\int_{B(p,r)} Z(x,y)dxdy}{\pi r^2}$ for some small fixed $r$.
The way I have decide to do this is via convolution with a $\delta$ -like function, and thus via multiplication of the respected FFT transforms.
I find the FFT of $Z$, as well as the FFT of a cylinder with base $B(0,r)$, and volume $1$. Then I take the product of the FFT transforms, and then take the absolute value of the inverse transform to be $\hat Z$.
Visually, the result looks correct, i.e. when plotting $\hat Z$ it does look like the original, only more "smoothed-out". When I increase $r$, the result becomes further flatter and flatter.
But the are some scaling issues, by which I mean that the scaling of the end result is completely off (orders of magnitude), whereas for small $r$ I expect the range to be roughly the same. I suspect that to be a known issue with the FFT transform, but I do not manage to find the proper scaling factor.