Hi, Cliff,

ConvolveND, at least, uses auto-centering in the kernel, which is  
considered to go from positions of (-N/2) to (N-N/2-1), rather than  
(0) to (N-1).  That prevents convolve from offsetting the input image  
in the most typical case of a centered PSF.



On Dec 29, 2009, at 3:43 PM, Cliff Sobchuk wrote:

> Hi Chris,
>
> I am looking at the outputs that you provided, and they all look
> incorrect to me. The convolution shouldn't be 0 for the first 5
> elements, then element 6 = 2, element 7 = 0, element 8 = -1, element
> 9..11 = 0.
>
> Comments? (btw, I am on vacation until Jan.4 so you might get an ooo
> alert, but every couple of days I check my email.)
>
> Cliff Sobchuk esn 361-8169, 403-262-4010 ext: 361-8169
> Fax: 403-262-4010 ext: 361-8170
> Core RF Support Engineer
>
>       "The author works for Telefonaktiebolaget L M Ericsson
> ("Ericsson"), who is solely responsible for this email and its  
> contents.
> All inquiries regarding this email should be addressed to Ericsson.
> Nortel has provided the use of the nortel.com domain to Ericsson in
> connection with this email solely for the purpose of connectivity and
> Nortel Networks has no liability for the email or its contents. The  
> web
> site for Ericsson is www.ericsson.com."
>
>
> -----Original Message-----
> From: Chris Marshall [mailto:[email protected]]
> Sent: December 19, 2009 12:33 PM
> To: [email protected]
> Cc: perldl
> Subject: [Perldl] conv1d or corr1d
>
> I would like to fix the fftconvolve() bug for the PDL-2.4.6
> release:
>
> http://sourceforge.net/tracker/?func=detail&aid=2630369&group_id=612&ati
> d=100612
>
> but I'm having problems since it appears that our PDL conv1d() routine
> actually calculated the 1D correlation of the arguments.
>
> First set up simple arguments:
>
>   perldl> $a = zeroes(11);
>   perldl> $a(5) .= 1;
>   perldl> p $a
>   [0 0 0 0 0 1 0 0 0 0 0]
>
>   perldl> $b = pdl(2,0,-1);
>   perldl> p $b
>   [2 0 -1]
>
> The analytic convolution is calculated to be:
>
>   perldl> $ctrue = $a->zeroes;
>   perldl> $ctrue(4) .= 2;
>   perldl> $ctrue(6) .= -1;
>   perldl> p $ctrue
>   [0 0 0 0 2 0 -1 0 0 0 0]
>
> Here are the various PDL convolution outputs:
>
>   perldl> p $c1d = conv1d $a, $b;     # wrong!
>   [0 0 0 0 -1 0 2 0 0 0 0]
>
>   perldl> use PDL::Image2D
>   perldl> p $c2d = conv2d $a, $b;      # right!
>   [
>    [ 0  0  0  0  2  0 -1  0  0  0  0]
>   ]
>
>   perldl> use PDL::ImageND
>   perldl> p $cNd = convolveND $a, $b;  # right!
>   [0 0 0 0 2 0 -1 0 0 0 0]
>
> The good news is that the conv2d() and convolveND() routines appear to
> be calculating a convolution so the only "broken"
> routine appears to be the conv1d().  My plan is to add a test for the
> bug, fix the code/docs, and update the Release_Notes
>
> --Chris
>
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>
> _______________________________________________
> PDL-porters mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/pdl-porters
>


_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to