To contrast-stretch an image I use
CvNormalize(img,img,0,255, NormType.MinMax);
This will set the minimum to 0 and the maximum to 255, stretching all values in between.
But is there a way to specify a percentage of values that should be cut off? If I want to stretch the image so that 5% of the lowest values and 5% of the highest values are clipped, and the remaining values stretched from 0-255, what combination of opencv commands could I use to accomplish that?