Re: CONVOL with 2D array and 1D kernel [message #52971] |
Fri, 09 March 2007 09:52 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Eric Hudson writes:
> This level of detail was why I was hoping for reference to some
> readable source. In any case, whether centered or not, the behavior
> of instantly setting all values in one row to zero once a 'magic'
> number of columns is reached is the problem I'd really like to
> understand. It seems like a bug but if this is expected behavior then
> I'd like to know because it means I really don't understand what the
> function is doing.
Well, when I want to understand something like "convolution"
(and I very seldom ever do!), I always pull out my trusty
copy of Gonzales and Woods' Digital Image Processing. It's
the only book on these topics I've ever been able to understand. :-)
> It was my understanding that this is what /edge_truncate does -- just
> duplicates the edge values once you get to the edge. I do not expand
> the array myself.
I think you are right. I was just fishing around for a
possible source of this weirdness. But, unfortunately,
I have no more ideas. :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: CONVOL with 2D array and 1D kernel [message #52972 is a reply to message #52971] |
Fri, 09 March 2007 09:38  |
Eric Hudson
Messages: 19 Registered: June 2006
|
Junior Member |
|
|
On Mar 9, 9:42 am, David Fanning <n...@dfanning.com> wrote:
> Eric Hudson writes:
>> Also, there seems to be a lot of confusion about what CONVOL really
>> does. Is there a definitive, readable, source so I can make sure that
>> I'm really doing what I want here (a true mathematical convolution
>> where I've made the array a bit bigger on the edges by duplicating the
>> top & bottom rows, done the convolution, and then chopped off the
>> edges to minimize edge effects).
>
> I'm no convolution expert, but the documentation is
> pretty clear that if you want to do a convolution in
> a "mathematical" sense (as you appear to do), then you
> are going to have to explicitly set the CENTER keyword
> to zero. Otherwise, you are going to do a convolution
> in an "image processing" sense, which may not be what
> you had in mind.
>
This level of detail was why I was hoping for reference to some
readable source. In any case, whether centered or not, the behavior
of instantly setting all values in one row to zero once a 'magic'
number of columns is reached is the problem I'd really like to
understand. It seems like a bug but if this is expected behavior then
I'd like to know because it means I really don't understand what the
function is doing.
> Also, have you expanded the 2D array yourself, or are
> you hoping IDL is going to do that for you? If you did
> it yourself, is it possible some of the values are not
> what you think they are?
>
It was my understanding that this is what /edge_truncate does -- just
duplicates the edge values once you get to the edge. I do not expand
the array myself.
Thanks,
Eric
|
|
|
Re: CONVOL with 2D array and 1D kernel [message #52981 is a reply to message #52972] |
Fri, 09 March 2007 06:42  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Eric Hudson writes:
> Also, there seems to be a lot of confusion about what CONVOL really
> does. Is there a definitive, readable, source so I can make sure that
> I'm really doing what I want here (a true mathematical convolution
> where I've made the array a bit bigger on the edges by duplicating the
> top & bottom rows, done the convolution, and then chopped off the
> edges to minimize edge effects).
I'm no convolution expert, but the documentation is
pretty clear that if you want to do a convolution in
a "mathematical" sense (as you appear to do), then you
are going to have to explicitly set the CENTER keyword
to zero. Otherwise, you are going to do a convolution
in an "image processing" sense, which may not be what
you had in mind.
Also, have you expanded the 2D array yourself, or are
you hoping IDL is going to do that for you? If you did
it yourself, is it possible some of the values are not
what you think they are?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|