comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Does CONVOL convolute
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Does CONVOL convolute [message #34145] Tue, 25 February 2003 09:21 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
condor@biosys.net (Big Bird) writes:

> David Fanning <david@dfanning.com> wrote in message news:<MPG.18c41ee199cd0d0b989afb@news.frii.com>...

>> Setting CENTER=1 or /CENTER is the same as leaving the CENTER
>> keyword off. (Don't ask!)

> Oy, I'll ask anyways: Who's grand idea was that?

>> If you want to perform convolution in
>> the "strictly mathematical" sense, you must explicitly set CENTER=0.
>> Is this what you were after:
>>
>> IDL> print,convol(tt,k, center=0)
>> 0.000000 0.000000 0.000000 0.000000 0.000000
>> 0.000000 0.000000 0.000000 0.000000 0.000000
>> 0.000000 0.000000 1.00000 0.000000 0.000000
>> 0.000000 0.000000 0.000000 0.000000 0.000000
>> 0.000000 0.000000 0.000000 0.000000 0.000000


> Huh? No, that isn't what I was after either.

> Maybe I'm thinking something completely wrong here somewhere but if my
> array is

> 1 0 0
> 0 0 0 ...
> 0 0 0
> .
> .

> and my convolution kernel is

> a b c
> d e f
> g h i

> then I would expect the convolution to be

> e f 0
> h i 0 ...
> 0 0 0
> .
> .

> At least for a symmetric kernel (I'd have to think about an
> unsymmetric one). ...

Actually, for an asymmetric kernel, the answer should be

e d 0
b a 0
0 0 0

What I usually do in this sort of situation is to embed my array within a
bigger array, to get around the edge effects within these IDL routines. Thus,
I would make my array

0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 1 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0

of which the center 3x3 portion is the real array. The convolution with the
kernal would then be

0 0 0 0 0 0 0
0 i h g 0 0 0
0 f e d 0 0 0
0 c b a 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0

And taking the center 3x3 portion gives the expected answer.

William Thompson
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: X11 0.2.1,OpenGL and IDL object Graphics
Next Topic: Update [ was Re: Is there a way to use C++ code in IDL ]

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:56:57 PDT 2025

Total time taken to generate the page: 0.00371 seconds