From: nicolas Date: Wed, 1 Aug 2012 18:09:01 +0000 (+0000) Subject: sigmoid formula matches code X-Git-Tag: 7.0.1-0~5218 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aea8f4e931afc6b7fdb747d6118bd6ee1b6dc3a1;p=imagemagick sigmoid formula matches code --- 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/