A system and method for enhancing the contrast within an image. An
enhanced image can be generated in a real-time or substantially real-time
manner from an initial image. The pixel values of the initial image can
be used to populate a histogram or otherwise serve as the basis for
subsequent processing. A valley can be identified within the range of
pixel values for use as a stretch metric used by a stretch heuristic to
expand the contrast of the pixel values in the initial image by expanding
the range of pixel values associated with the pixels in the histogram. In
some embodiments, the initial image is first divided into image regions
that are each associated with individualized processing. A bilinear
interpolation step can then be performed to smooth the integrated image
after the individualized processing is used to stretch the pixels within
the individual image regions.