contrast curves problems I am doing some tests about local/global contrast algorithms and need a simple equation to define an arbitrary S-shaped contrast curve. It's simple if the turning point is assumed to be (0.5, 0.5), but couldn't find a straight equation if the turning point has to be arbitrarily set.

These are the typical contrast curves I achieved for turning point in the middle (0.5, 0.5):


And the simple equations follow this rule:

y = x^2*2 for x&lt;=0.5

y = 1-(1-x)^2*2 for x>0.5

I would like to be able to allocate the turning point to any (x,y) position and still have a smooth S-shaped curve where the slope is continuous on both sides of the turning point. I would like to keep the equation as simple and straightforward as possible, avoiding the use of splines or any other more complex math.

Any ideas? I tried to google I found some equation like this.

y = [ (1-s)x + sa*(x/a)^E ] ^ ( log(b)/log(a) )

Parameters:
(a,b): turning point 

s: slope at ends 

E: contrast strength 

But it does not work like this 



Would you please let me know how do I make the equation like above.
One good way is to utilize Bezier curves (or Catmull Rom splines). This way, you could define the control points in the way you like. Positioning of the control points would then allow you to adjust the histogram to the desired output. 

I would suggest Catmull Rom splines if you want them to pass through the control points. It gives you better control over the curve behavior. Use 5 such points: 2 for the end points, 1 for the middle, and 1 on each side of the center to give you certain curvature. 



If you don't want to use splines, the black curve looks like a Sigmoid function, while the yellow is a third order polynomial.

You can checkout this code to see different implementations. 



If you are keen on using Logistic family, then I would suggest the generalized logistic growth curve with horizontal asymptotes at $−1$ and $1$:

$y(t)=-1+\frac{2}{[1+ke^{-\beta t}]^{1/v}}$

where $k &gt; 0$, $β &gt; 0$ and $ν &gt; 0$. The parameter $k$ can be adjusted by a time shift, $β$
corresponds to a scaling of time; $ν$ is the key parameter that determines the shape of the
growth, the asymmetry depending on whether it is less than or greater than $1$. This formula reduces to the standard logistic growth for $ν = 1$, $k = 1$, $β = 2$. The turning point you refer to is commonly known as the inflection point, where the derivative changes sign.

This is explained in detail Ayse Humeyra's article and here. Here is a MATLAB code:

function [y]= general_logistic(t, k, beta, v)
y = -1 + 2./((1+k*exp(-beta.*t)).^(1./v));
end




Finally, in Dino Dini's blog, he explains the normalized tunable sigmoid functions. There, the solution to your problem is addressed. Moreover, a similar question is already posted and answered here. Last but not least, polynomial shaping functions, which would serve the same necessities are discussed in Golan Levin's page.

I hope all these would help.