View Single Post
  #28  
Old 15-06-2011, 10:43 PM
Danack (Dan Ackroyd)
Registered User

Danack is offline
 
Join Date: Mar 2011
Posts: 125
"Im thinking a simple non linear offset to the vertical scale would be the go, but I just cant find it testing in excel," - So it's okay to just suggest things that will allow a new table to be generated in excel?


I think you just need the two functions bias and gamma below to tweak your curve...

function smoothCurve( float x){

return 1/(1+EXP(-x))

//I prefer this as a smooth curve:
//return t * t * (3.0f - 2.0f * t);
}


function bias(float value, float bias){
return Math.pow(value, Math.log(bias) / Math.log(0.5));
}

function gamma(float value, float gamma){
return Math.pow(value, gamma);
}


float gammaValue = 2.2;
float biasValue = 0.75;


for(x=0; x<=255; x++){
float value = x / 255.0f;
value = smoothCurve(value);
value = bias(value, biasValue);
value = gamma(value, gammaValue);

//store value in your table.
}



The bias function makes the curve more 'steep' or less 'steep'.
The gamma function keeps it closer to the x-axis or further away.


Quote:
An integer PIC cant do any of the functions you describe to recalculate the curve live.
*raises single eyebrow*

Is that....a challenge?
Reply With Quote