A method and apparatus for processing image data is described, comprising acquiring
a frame of image data and compressing the dynamic range of the frame of image data
using a dynamic range compression (DRC) algorithm that utilizes down-sampling,
median filtering, and up-sampling. The DRC algorithm comprises down-sampling a
frame of image data comprising a first array of pixels to generate a second array
of pixels, applying a first median filter to the second array of pixels to generate
a blurred array of pixels, up-sampling the blurred array of pixels, and removing
at least a portion of low-frequency gradient data generated by previous steps from
the frame of image data.