Does CONVOL convolute [message #34161] |
Mon, 24 February 2003 11:01 |
condor
Messages: 35 Registered: January 2002
|
Member |
|
|
OK, I'm kinda puzzled here -- can someone explain the following to me
(IDL 5.5 on linux if it makes a difference)?
Let there be a simple symmetric 2D array and a simple symmetric kernel
-- then the result is exactly what I expect:
IDL> tt = fltarr(5,5)
IDL> tt[2,2] = 1
IDL> print,tt
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 1.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
IDL> k = float([[1,2,1],[2,4,2],[1,2,1]])
IDL> print,k
1.00000 2.00000 1.00000
2.00000 4.00000 2.00000
1.00000 2.00000 1.00000
IDL> print,convol(tt,k)
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 1.00000 2.00000 1.00000 0.00000
0.00000 2.00000 4.00000 2.00000 0.00000
0.00000 1.00000 2.00000 1.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
But leaving the kernel alone, and just making the original array
unsymmetric, I get something entirely unexpected:
IDL> tt = fltarr(5,5)
IDL> tt[0,0] = 1
IDL> print,tt
1.00000 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
IDL> print,convol(tt,k)
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 1.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000 0.00000
Huh?
I get the same results with or without the /center keyword to convol.
I had some code that relied on the fact that convolution of a non-zero
element in tt cannot result in a zero element in tt if the convolution
kernel is non-zero everywhere. Well, so much for that idea. Can
someone tell me what I'm thinking wrong here?
|
|
|