Sigma Formula for image C++

1.6k views Asked by At

I'm trying to make a certain tone curve which is known as Sigma.

Unfortunately, I do not know the formula for Sigma, i somehow cant find the formula for it. Can anyone help me? Thanks

Based on a graph x and y axis and this website : 3rd link: http://www.mediachance.com/pseam/help/curves.html

Using Windows Visual Studio 2010

for(int y=0; y<bih.biHeight; y++)
            {                       
                for(int x=0; x<bih.biWidth; x++)
                {   
                SetPixel(hdc, ((double)x/(double)(x+20))*bih.biWidth, bih.biHeight-x, red);
                }
1

There are 1 answers

2
Martin Beckett On BEST ANSWER

Looks like a sigmoid curve http://en.wikipedia.org/wiki/Logistic_curve

y = 1 / ( 1 + e^-x ) adjust x to change steepness and scale into the output range (0-255).

hint: you probably want to precalculate the function and make a lookup table with 256 inputs for each possible pixel level