[SciPy-User] How to convolve with transfer function

josef.pktd@gmai... josef.pktd@gmai...
Wed Dec 5 19:19:49 CST 2012


On Wed, Dec 5, 2012 at 5:23 PM,  <rmain@gmx.de> wrote:
> Hi everyone. I want to do the following:
> I have an image and want to apply the transfer function
> http://www.abload.de/img/tfbiif7.png to my image. However, in the
> article I am using it said the following:
> "Due to the singularity in the log function at the origin, one cannot
> construct an analytic expression for the shape
> of the Log-Gabor function in the spatial domain. Therefore, the filters
> are constructed in the frequency domain."
> So it has to be used in the frequency domain. I first have to transform
> my image via FFT. For that, I found the function numpy.fft.rfft2 which
> does the transformation. However I'm at a loss on how to apply the
> transfer function to the array. I found the scipy.signal.convolve
> method, however that one seems to work with arrays. But I can't figure
> out how to convolve with this transfer function if it can't be defined
> as an array.
> Would you please help me with my problem?

Hopefully there will be a more specific answer.

What I did in a similar case (but not with images) is to take fftconvolve
https://github.com/scipy/scipy/blob/v0.11.0/scipy/signal/signaltools.py#L134
replace
IN1 *= fftn(in2, fsize)
with
IN1 *= G(w)

where G(w) is the Fourier transform of the transfer function that you
have given in your formula.

The problem that I usually had was figuring out what the frequencies,
w, are supposed to be, and what shape G(w) is supposed to have.

(recipe how to cannibalize scipy source, not for your specific problem)

Josef

>
> Cheers
> Robert
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user


More information about the SciPy-User mailing list