From aea8f4e931afc6b7fdb747d6118bd6ee1b6dc3a1 Mon Sep 17 00:00:00 2001 From: nicolas Date: Wed, 1 Aug 2012 18:09:01 +0000 Subject: [PATCH] sigmoid formula matches code --- MagickCore/enhance.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/MagickCore/enhance.c b/MagickCore/enhance.c index 9fa0db5d7..982c8923b 100644 --- a/MagickCore/enhance.c +++ b/MagickCore/enhance.c @@ -3392,9 +3392,14 @@ MagickExport MagickBooleanType SigmoidalContrastImage(Image *image, (sigmoidal(contrast,QuantumScale*midpoint,(double)i/MaxMap) -(u0+u1)/2.0)/(u1-u0+MagickEpsilon)+0.5) )); #else - /* Scaled sigmoidal formula... - (1/(1+exp(a*(b-u))) - 1/(1+exp(a))) / - (1/(1+exp(a*(b-1)))/(1+exp(a)))) */ + /* Scaled sigmoidal formula: + * (1/(1+exp(a*(b-u))) - 1/(1+exp(a*b))) + * / (1/(1+exp(a*(b-1))) - 1/(1+exp(a*b))) + * + 0.5 + * + * Nicolas strongly suspects that the +0.5 in the code is at the + * wrong paren nesting (does not match the previous one). + */ sigmoidal_map[i]=(MagickRealType) ScaleMapToQuantum((MagickRealType) (MaxMap*((1.0/(1.0+exp(contrast*(midpoint/(double) QuantumRange- (double) i/MaxMap))))-(1.0/(1.0+exp(contrast*(midpoint/ -- 2.40.0