This prevents outliers affecting the scaling so much. The intensity histogram is then scanned upward from 0 until the first intensity value with contents above the cutoff fraction. This defines c . Similarly, the intensity histogram is then scanned downward from 255 until the first intensity value with contents above the cutoff fraction. This defines d .
Some implementations also work with color images .
In this case all the channels will be stretched using the same offset and scaling in order to preserve the correct color ratios. Guidelines for Use Normalization is commonly used to improve the contrast in an image without distorting relative graylevel intensities too significantly. In this case, we can achieve better results by contrast stretching the image over a more narrow range of graylevel values from the original image. As shown in the histogram most of the information to the left of the peak in the original image is mapped to 0 so that the peak can spread out even further and begin pushing values to its right up to 255. As an example of an image which is more difficult to enhance, consider which shows a low contrast image of a lunar surface.