Histogram Equalization (HE) and its variations have been widely used in image enhancement. Even though these approaches may enhance image contrast in an effective and efficient way, they usually face some undesired drawbacks, like loss of image details, noise amplification and overenhancement. In this paper, we propose a generalized histogram equalization technique based on localized image analysis. Starting from designing two measures f1 and f 2 to measure local characteristics around each pixel, the global statistics of these two local measures are then recorded into an extended histogram. Based on this extended histogram, we develop a procedure to generate suitable intensity transfer functions for various applications, like contrast enhancement and shadow enhancement. Experimental results show that the proposed algorithm provides a flexible and efficient way for image enhancement.