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

Home » Public Forums » archive » Re: 2-D Convolutions in IDL w/o zero-padded edges
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: 2-D Convolutions in IDL w/o zero-padded edges [message #56391] Wed, 24 October 2007 01:56
Tal is currently offline  Tal
Messages: 26
Registered: August 2007
Junior Member
>> Is there a way in IDL to convolve an image with a kernal and return only those parts of the convolution that are computed without zero-padded edges?

Yes. i think so.

if
b is the result
a is the source image
k is the kernel
s is the scale factor (for example: total(k))

then
b = convol(a,k,s,/edge_truncate)

should produce what you want and will not pad the edges with zeros.

hope this helps,
Tal
Re: 2-D Convolutions in IDL w/o zero-padded edges [message #56396 is a reply to message #56391] Tue, 23 October 2007 14:50 Go to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
Matt Harner wrote:
> Hello.
>
> I am familiar with IDL and convolutions independently but not
> together. Is there a way in IDL to convolve an image with a kernal
> and return only those parts of the convolution that are computed
> without zero-padded edges? This would be equivalent to the MATLAB
> procedure conv2(image,kernel, 'valid').
>
> Thanks in advance for any help.
> Matt

Maybe you could compute the convolution over the whole area, then keep
only the valid entries... so if your kernel is a 3*3 one, you would do

GoodResults = AllResult[1:Xsize-2; 1:Ysize-2]

If you are using a kernel that is not a square, I have a function to
reduce your study area so that every pixel has a complete neighborhood
(you define the neighborhood by its coordinates as if it was centered on
cell 0;0)

Jean
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Need help reconstructing flat-field. Minimization problem.
Next Topic: Re: transform a floating point into byte or integer in envi

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

Current Time: Fri Oct 10 20:39:27 PDT 2025

Total time taken to generate the page: 0.79899 seconds