[Numpy-discussion] Error in nd_image filters?
Peter Verveer
verveer at embl-heidelberg.de
Fri Jun 3 15:05:17 EDT 2005
That seems to be indeed correct. In fact the line 'weights[lw] = -1.0'
must also be changed to 'weights[lw] *= -1.0 / sd'. I committed these
changes to CVS.
Thanks for spotting this, Peter
On Jun 3, 2005, at 8:39 PM, Russel Howe wrote:
> I think there is an error in the 2nd and 3rd derivative gaussian
> kernels in the nd_image module. I have attached a patch which I
> believe has the correct formula, would someone please double-check me
> on this?
> Thanks
> Russel Howe
> --- numarray-1.3.2/Packages/nd_image/Lib/filters.py 2005-03-08
> 15:58:08.000000000 -0800
> +++ numarray-1.3.2-modified/Packages/nd_image/Lib/filters.py
> 2005-05-05 15:52:00.000000000 -0700
> @@ -189,7 +189,7 @@
> weights[lw] = -1.0
> for ii in range(1, lw + 1):
> x = float(ii)
> - tmp = (2.0 * x * x / sd - 1.0) * weights[lw + ii]
> + tmp = ( x * x / sd - 1.0 ) * weights[lw + ii] / sd
> weights[lw + ii] = tmp
> weights[lw - ii] = tmp
> elif order == 3: # third derivative
> @@ -197,7 +197,7 @@
> sd2 = sd * sd
> for ii in range(1, lw + 1):
> x = float(ii)
> - tmp = (6.0 - 4.0 * x * x / sd) * x * weights[lw + ii]
> + tmp = (3.0 - x * x / sd) * x * weights[lw + ii] / sd / sd
> weights[lw + ii] = tmp
> weights[lw - ii] = -tmp
> return correlate1d(input, weights, axis, origin = 0, mode = mode,
>
>
>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: NEC IT Guy Games. How far can you
> shotput
> a projector? How fast can you ride your desk chair down the office
> luge track?
> If you want to score the big prize, get to know the little guy. Play
> to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
More information about the NumPy-Discussion
mailing list