Saturday 31 August 2013

Gain

The gain() function (also known as a contrast function) has very different behavior. It leaves the values at 0, 0.5, and 1 unchanged and manipulates the values in the first segment (0 to 0.5) and the second segment (0.5, 1). Internally, it is calculated as two bias() operations applied to the first and second segments. The visual result of the gain()function is the increase or decrease of the value’s contrast.

Here is the function followed by Figure 5.7 and Figure 5.8, which are graphs of gain() at 0.25 and 0.85.

float gain(float val,g){
              return 0.5 * ((val < 0.5) ? bias(2 * val,1 - g) :
              (2 - bias(2 - 2 * val,1 - g)));
}



No comments:

Post a Comment