From b8daaf7a8e3148327d53a86a008592efc97e1138 Mon Sep 17 00:00:00 2001 From: anthony Date: Fri, 10 Sep 2010 14:37:52 +0000 Subject: [PATCH] Fix Gaussian Filter mistake (constant moved into exp()) --- magick/resize.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/magick/resize.c b/magick/resize.c index efc51a061..8791a516f 100644 --- a/magick/resize.c +++ b/magick/resize.c @@ -227,11 +227,11 @@ static MagickRealType Gaussian(const MagickRealType x, const ResizeFilter *magick_unused(resize_filter)) { /* - Unnormalized Gaussian with variance sqrt(pi)/(4*sqrt(2)): - exp(-2 x^2/sqrt(pi/2)) + exp(-2 x^2)*sqrt(2/pi)) */ - const MagickRealType alpha = -sqrt((double) (8.0/MagickPIL)); - return(exp((double) (alpha*x*x))); + //const MagickRealType alpha = sqrt((double) (2.0/MagickPIL)); + const MagickRealType alpha = 2.0/MagickSQ2PI; + return(exp(-(double)(2.0*x*x))*alpha); } static MagickRealType Hanning(const MagickRealType x, -- 2.40.0