]> granicus.if.org Git - imagemagick/commitdiff
minor sigmoidal tweak
authornicolas <nicolas@git.imagemagick.org>
Tue, 4 Sep 2012 16:32:34 +0000 (16:32 +0000)
committernicolas <nicolas@git.imagemagick.org>
Tue, 4 Sep 2012 16:32:34 +0000 (16:32 +0000)
MagickCore/enhance.c

index ea7246713c96beb25f72b0b23cd12b38307c2f4d..927114fe7514020f361d8c96e39532c02aab5faf 100644 (file)
@@ -3379,8 +3379,8 @@ MagickExport MagickBooleanType SigmoidalContrastImage(Image *image,
     The limit of ScaledSig as a->0 is the identity, but a=0 gives a
     division by zero. This is fixed below by hardwiring the identity when a
     is small. This would appear to be safe because the series expansion of
-    the sigmoidal function around x=b is 1/2-a*(b-x)/4+... so that s(1)-s(0)
-    is about a/4.
+    the logistic sigmoidal function around x=b is 1/2-a*(b-x)/4+... so that
+    s(1)-s(0) is about a/4. (With tanh, it's a/2.)
   */
 #define ScaledSig(a,b,x) ( \
   (Sig((a),(b),(x))-Sig((a),(b),0.0)) / (Sig((a),(b),1.0)-Sig((a),(b),0.0)) )
@@ -3410,7 +3410,7 @@ MagickExport MagickBooleanType SigmoidalContrastImage(Image *image,
     ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
       image->filename);
   (void) ResetMagickMemory(sigmoidal_map,0,(MaxMap+1)*sizeof(*sigmoidal_map));
-  if (contrast<4.0*MagickEpsilon)
+  if (contrast<MagickEpsilon)
     for (i=0; i <= (ssize_t) MaxMap; i++)
       sigmoidal_map[i]=ScaleMapToQuantum((double) i);
   else if (sharpen != MagickFalse)