1. A method for filtering an input image with a bilateral filter to produce an output image, wherein the bilateral filter includes a spatial filter and a range filter, comprising the steps of: constructing an integral histogram from an input image including pixels, and wherein each pixel has an intensity; applying, for each pixel, the spatial filter to the integral histogram to produce a local histogram, each local histogram having a bin for a specified range of intensities of the pixels, each bin associated with a coefficient indicating a number of pixels in the specified range and an index to the coefficient; subtracting, for each bin in each local histogram, an intensity of the pixel from each index of the bin to produce a difference value; applying, for each bin, the range filter to each difference value to produce a response; scaling, each response by the corresponding coefficient to produce a scaled response; summing, for each local histogram, the scaled responses to produce a local response for the local histogram; summing, for each local histogram, the coefficients to produce a sum of the coefficient; and dividing, for each pixel, the local response by the sum of the coefficients to produce a response for the bilateral filter, which forms an output image.