title: Which sigmoid function to use for increasing contrast of an image?
body: <p>Is there a standard sigmoidal function used to increase the contrast in a gray level bitmap?</p>
  <p>Currently I am using the following. This would be applied to gray levels represented at values between 0 and 1 inclusive.</p>
  <pre><code>static double ContrastCurve(double val, double k = 1)
  {
      Func&lt;double,double&gt; logistic_func = (double x) =&gt; 1.0 / (1.0 + Math.Exp(-k * (x - 0.5)));
      var low = logistic_func(0);
      var high = logistic_func(1);
      var range = high - low;
      var value = logistic_func(val);
      return (value - low) / range;
  }
  </code></pre>
  <p>This is <a href="https://en.wikipedia.org/wiki/Logistic_function" rel="nofollow noreferrer">the logistic function</a> applied to a value between 0 and 1 with the output normalized so that the output is also in [0...1]. This function works but it is completely arbitrary, something I just made up, so the <code>k</code> param has no official name or meaning in image processing literature and so forth.</p>
  <p>If there is a function that is standard I would prefer that but haven't found anything that seems definitive. Code such <a href="https://www.dfstudios.co.uk/articles/programming/image-programming-algorithms/image-processing-algorithms-part-5-contrast-adjustment/" rel="nofollow noreferrer">as this link</a> seems as ad hoc to me.</p>