fourier transform [message #45093] |
Mon, 01 August 2005 08:16  |
Pravesh
Messages: 17 Registered: August 2004
|
Junior Member |
|
|
Hi ,
I am trying to convolute a huge gaussian kernel ([192,192]) with an
image array ([512,512]). of course, if i had all the time on earth, i
could use the convol routine.
can someone tell me how do i get it done faster by using fourier
transform?
more specifically,
smoothimage = raw convol image
= something in terms of fourier transform
please don't mind my excellent math skills.
thanks,
pravesh
|
|
|
Re: Fourier Transform [message #74090 is a reply to message #45093] |
Thu, 23 December 2010 14:15  |
R.G.Stockwell
Messages: 163 Registered: October 2004
|
Senior Member |
|
|
"Ammar Yusuf" <amyusuf1@gmail.com> wrote in message
news:0976cc7b-4c34-4355-aa06-1cc52757cbe7@o14g2000yqe.google groups.com...
> Hi, let's say I have 2 graphs (2 arrays with numbers). They both look
> different but are similar. I'm doing a FFT on one of the arrays and
> then zero out some of the coefficients and then do an inverse FFT on
> that array to try to get the 2nd array. When I plot the 2nd array and
> the inverse one I get something similar to it but not close enough.
> I've tried zeroing many coefficients but can't get anywhere. What
> would be the best way to do this? Thanks.
offhand, simply zeroing out coefficients in an fft is a lousy way to filter
(quick and dirty, emphasis on dirty).
I don't have a clear idea of what your aim is, but here are a couple of
points. Are you trying to show
the same wave energy is present in both images? do a cross spectral
analysis S1 * conj(S2).
given two images I1 and I2 and the two spectra S1 and S2,
look at the ratio of abs(S2)/abs(S1). That will show you were the
difference are, but make
sure you treat the zero points (and small value points) of abs(s1). I'd do
the division and
then mask out the points of abs(S2)/abs(S1) where abs(S1) is small.
note: when you ifft into the image domain, you will not have the correct
phase, so the waves
will likely shift in the image domain and there can be interference.
you could try something like
I2new = inverse FFT ( S1 * abs(S2)/abs(S1) )
again, I have no idea what the goal is, so I can't really say anything more.
cheers,
bob
|
|
|
Re: Fourier Transform [message #74127 is a reply to message #45093] |
Tue, 21 December 2010 14:27  |
Ammar Yusuf
Messages: 36 Registered: October 2010
|
Member |
|
|
On Dec 21, 2:55 pm, Paolo <pgri...@gmail.com> wrote:
> Given two random arrays A1 and A2, you almost surely cannot find a
> passband filter that converts on into the other.
>
> Ciao,
> Paolo
>
> On Dec 21, 12:41 pm, Ammar Yusuf <amyus...@gmail.com> wrote:
>
>> Hi, let's say I have 2 graphs (2 arrays with numbers). They both look
>> different but are similar. I'm doing a FFT on one of the arrays and
>> then zero out some of the coefficients and then do an inverse FFT on
>> that array to try to get the 2nd array. When I plot the 2nd array and
>> the inverse one I get something similar to it but not close enough.
>> I've tried zeroing many coefficients but can't get anywhere. What
>> would be the best way to do this? Thanks.
>
>
They are not random. They come from some type of a model. One has
something called waves and the other doesn't. Thanks.
|
|
|
Re: Fourier Transform [message #74132 is a reply to message #45093] |
Tue, 21 December 2010 11:51  |
Kenneth P. Bowman
Messages: 585 Registered: May 2000
|
Senior Member |
|
|
In article
<0976cc7b-4c34-4355-aa06-1cc52757cbe7@o14g2000yqe.googlegroups.com>,
Ammar Yusuf <amyusuf1@gmail.com> wrote:
> Hi, let's say I have 2 graphs (2 arrays with numbers). They both look
> different but are similar. I'm doing a FFT on one of the arrays and
> then zero out some of the coefficients and then do an inverse FFT on
> that array to try to get the 2nd array. When I plot the 2nd array and
> the inverse one I get something similar to it but not close enough.
> I've tried zeroing many coefficients but can't get anywhere. What
> would be the best way to do this? Thanks.
Do FFTs of both arrays and compare the coefficients. If you change
the coefficients of the first FFT to match the coefficients of the
second FFT and then inverse FFT, you will get something that is
*very* similar to the second function. ;-)
But seriously, compare the coefficients from the FFTs. That will
tell you the difference between the two functions in the spectral domain.
Ken Bowman
|
|
|
Re: Fourier Transform [message #74133 is a reply to message #45093] |
Tue, 21 December 2010 11:55  |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
Given two random arrays A1 and A2, you almost surely cannot find a
passband filter that converts on into the other.
Ciao,
Paolo
On Dec 21, 12:41 pm, Ammar Yusuf <amyus...@gmail.com> wrote:
> Hi, let's say I have 2 graphs (2 arrays with numbers). They both look
> different but are similar. I'm doing a FFT on one of the arrays and
> then zero out some of the coefficients and then do an inverse FFT on
> that array to try to get the 2nd array. When I plot the 2nd array and
> the inverse one I get something similar to it but not close enough.
> I've tried zeroing many coefficients but can't get anywhere. What
> would be the best way to do this? Thanks.
|
|
|