I am developing a filter in Pixel Bender. It needs me to apply an auto-fix to the image before the filter is applied.
Currently this is my progress in it ->
dst = sampleNearest(src,outCoord());
dst.r = ((dst.r - 0.5)*contrast)+ 0.5;
dst.g = ((dst.g - 0.5)*contrast)+ 0.5;
dst.b = ((dst.b - 0.5)*contrast)+ 0.5;
dst.r = dst.r * brightness;
dst.g = dst.g * brightness;
dst.b = dst.b * brightness;
Bu the problem here is, in this case I have to manually change the contrast and brightness parameters. How do i apply an auto-fix on this image without having to manually change the parameters.