1. A method for enhancing an input image to produce a contrast enhanced output image, the method comprising: producing a contrast value for each pixel in the input image, said contrast value being proportional to an intensity gradient between each respective pixel and at least one pixel adjacent said respective pixel; selecting pixels in said input image having respective contrast values that meet a first criterion, thereby forming a selected plurality of pixels; producing a frequency distribution of intensity values of said selected plurality of pixels; selecting at least one range of intensity values in said frequency distribution that meet a second criterion, thereby producing a selected range of intensity values for enhancement; producing a tone mapping function for mapping pixel intensity values in the input image to pixel intensity values in the output image; producing the contrast enhanced output image by computing an output intensity value according to said tone mapping function for every pixel in the input image, wherein said producing comprises at least one of: selectively expanding the pixel intensity values of all of those pixels in the input image with pixel intensity values that fall within said selected range of intensity values; and selectively compressing the pixel intensity values of all of those pixels in the input image with pixel intensity values that fall outside said selected range of intensity values.