#pixels Gray level histograms 3.5 4 x 104 3 Histogram Brain image 2.5 2 1.5 1 0.5 0 0 50 100 150 200 250 gray level Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 1
#pixels 3.5 x 104 3.5 x 3 104 Gray level histograms 2.5 3 2.5 2 1.5 2 1.5 1 0.5 1 Bay image 0.5 0 0 50 100 150 200 250 0 0 50 100 150 200 250 gray level Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 2
Gray level histogram in viewfinder Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 3
Gray level histograms To measure a histogram: For B-bit image, initialize 2 B counters with 0 Loop over all pixels x,y When encountering gray level f [x,y]=i, increment counter #i Normalized histogram can be thought of as an estimate of the probability distribution of the continuous signal amplitude Use fewer, larger bins to trade off amplitude resolution against sample size. Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 4
Histogram equalization Idea: Find a non-linear transformation g T f that is applied to each pixel of the input image f [x,y], such that a uniform distribution of gray levels results for the output image g[x,y]. Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 5
Histogram equalization Analyse ideal, continuous case first... Assume Normalized input values 0 f 1 and output values 0 g 1 T( f ) is differentiable, increasing, and invertible, i.e., there exists f T 1 g 0 g 1 Goal: pdf p g (g) = 1 over the entire range 0 g 1 Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 6
Histogram equalization for continuous case From basic probability theory Consider the transformation function Then... p g p f f g T f p f d 0 f 1 g p f f f dg df 0 dg df p f f T 1 g f f p f f T f p f 1 f g f T 1 g 1 p g g p f f 0 g 1 dg df f T 1 g Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 7
Histogram equalization for discrete case Now, f only assumes discrete amplitude values f 0, f 1,, f L-1 with empirical probabilities P 0 = n 0 n P 1 = n 1 n Discrete approximation of P L-1 = n L-1 n where n = L-1 n l l=0 å f g T f p f d 0 pixel count for amplitude f l g k Tf k k i0 P i for k 0,1..., L 1 The resulting values g k are in the range [0,1] and might have to be scaled and rounded appropriately. Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 8
Histogram equalization example Original image Bay... after histogram equalization Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 9
Histogram equalization example Original image Bay... after histogram equalization Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 10
Histogram equalization example Original image Brain... after histogram equalization Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 11
#pixels #pixels Histogram equalization example Original image Brain... after histogram equalization 44 x x 104 104 44 x x 104 104 3.5 3.5 33 2.5 2.5 22 1.5 1.5 11 0.5 0.5 0 0 0 50 50 100 150 200 250 gray level 3.5 3.5 33 2.5 2.5 22 1.5 1.5 11 0.5 0.5 0 0 0 50 50 100 150 200 250 gray level Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 12
Histogram equalization example Original image Moon... after histogram equalization Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 13
#pixels #pixels Histogram equalization example Original image Moon... after histogram equalization 12 x 104 12 x 104 10 10 8 8 6 6 4 4 2 2 0 0 50 100 150 200 250 gray level 0 0 50 100 150 200 250 gray level Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 14
#pixels Output gray level Contrast-limited histogram equalization 0.7 no clipping 0.7 0.4 0.4 0.1 0.1 Input gray level Input gray level Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 15
Adaptive histogram equalization Histogram equalization based on a histogram obtained from a portion of the image Sliding window approach: different histogram (and mapping) for every pixel Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 16 Tiling approach: subdivide into overlapping regions, mitigate blocking effect by smooth blending between neighboring tiles Limit contrast expansion in flat regions of the image, e.g., by clipping histogram values. ( Contrast-limited adaptive histogram equalization ) [Pizer, Amburn et al. 1987]
Adaptive histogram equalization Original image Parrot Global histogram equalization Adaptive histogram equalization, 8x8 tiles Adaptive histogram equalization, 16x16 tiles Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 17
Adaptive histogram equalization Original image Dental Xray Global histogram equalization Adaptive histogram equalization, 8x8 tiles Adaptive histogram equalization, 16x16 tiles Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 18
Adaptive histogram equalization Original image Skull Xray Global histogram equalization Adaptive histogram equalization, 8x8 tiles Adaptive histogram equalization, 16x16 tiles Digital Image Processing: Bernd Girod, 2013-2014 Stanford University -- Histograms 19