Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

contrast-stretch whit clipping

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?

contrast-stretch whit with clipping

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 at least 5% of the resulting array are zeroes and 5% of the resulting array are 255,
(Or alternatively, 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, clipped),
what combination of opencv commands could I use to accomplish that?

contrast-stretch with clipping

To contrast-stretch an image I use

CvNormalize(img,img,0,255, NormType.MinMax); 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 at least 5% of the resulting array are zeroes and 5% of the resulting array are 255,
(Or alternatively, stretch the image so that 5% of the lowest values and 5% of the highest values are clipped),
what combination of opencv commands could I use to accomplish that?