ios - Input Power value for CIGammaAdjust filter in Core Image -
i want perform auto gamma correction using core image filter cigammaadjust. cigammaadjust requires "inputpower" value set in following code:
cifilter* gammafilter = [cifilter filterwithname:@"cigammaadjust"]; [gammafilter setvalue:resultimage forkey:@"inputimage"]; [gammafilter setvalue:??? forkey: @"inputpower"]; resultimage = [gammafilter valueforkey: @"outputimage"];
the question is, how should calculate value input power? have gamma value of image calculated. how convert image gamma value input power? tried using reciprocal of gamma value doesn't seem give right result.
this mac dev library says, "...
inputpower: nsnumber object attribute type ciattributetypescalar , display name power.
default value: 0.75
discussion: filter typically used compensate nonlinear effects of displays. adjusting gamma changes slope of transition between black , white. uses following formula:
pow(s.rgb, vec3(power))
so answer question, try ratios. max of inputpower believe 3.00, , minimum 0 .1. i'd take gamma value , divid max possible gamma value. multiply found value max inputpower value (2.9 3).
hope helps!
Comments
Post a Comment