简体   繁体   中英

Sigma Formula for image C++

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);
                }

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM