A method of calculating a brightness balance value for a digital image
including a plurality of pixels, comprising the steps of: calculating a
spatial activity measure in a plurality of local neighborhoods of pixels
of the digital image, each local neighborhood including a plurality of
pixels; generating a weighting factor for each of the local neighborhoods
of pixels as a function of the spatial activity of the local
neighborhoods of pixels, the weighting factors having more than two
possible values; and applying the weighting factors to the pixels of the
digital image to produce the brightness balance value.