1. A method for applying histogram equalization to an image, comprising: calculating a histogram of at least one image portion of an input image to obtain histogram data representing the number of occurrences of different brightness values in said at least one image portion, filling up said histogram data such that substantially all brightness values have a minimum number of occurrences, calculating a cumulative distribution function from said filled up histogram data, equalizing said cumulative distribution function in a predetermined range, and remapping said at least one image portion of the input image based on said equalized cumulative distribution function.