Question for the FFT wizards about how you'd implement something like this (SPECT related): Say you have a "depth-dependant" gaussian. So, a 1D Gaussian filter you want to apply to an image, but its std changes with the row number. Say that you can also "rotate" this Gaussian around the image, i.e. this also applies to some arbitrary angle (so its not anymore "row number" but some "distance from edge" that defines the width of the std).
how would you approach implementing in code such thing?
is there some FFT magic here I am missing, or do I need to do N FFTs??
@SardarUsama oh brother. Not a joke. Dynamic variable names on steroids
@AnderBiguri I'm not really an FFT person, but I would try 1. spelling out the usual Gaussian kernel DFT as a matrix operation (assuming that applies) then 2. doing a transform on the matrix elements of the kernel, and see if the result can be rewritten in a way that can make use of FFT machinery...
@AnderBiguri in the non-angled case: couldn't you also just stretch each row apply gauss of all the same size, then unstretch? It is probably even more inefficient though:)
@AnderBiguri If I understand correctly, the rotation and depth-dependence prevent you from using separable FFT's. Furthermore, because of depth-depence you can't even use convolution, right? Convolution would apply the same kernel in all rows / distances-from-edge
@AnderBiguri That's not a convolution, so cannot be computed through FFT. You need to loop over the image, and at each pixel find your kernel, multiply it by the neighboring pixels, etc. This is not necessarily bad, a lot of filters are implemented that way.
(cringe, documentation text is poorly worded, will have to rewrite some of those sentences)
> params[0] is the angle of the orientation
If you have only a few different kernel shapes (a few different orientations, or a few different sizes) then you can apply those filters to the whole image, and in a second step select one result for each pixel. Could be much faster because the individual filters would then be separable and thus cheaper to compute.
Depends on the size of the kernels, and the number of different ones you need to apply.