Histogram Manipulation CHAPTER 6 IMAGE ANALYSIS Histogram Manipulation A. Dermanis
x = 0 preserved as “no data” code The image histogram (e.g. p = 8, 8-bit) x = 1, 2, …, 255 Pixel values for a p-bit digital image: x = 1, 2, …, 2p-1 x = 0 preserved as “no data” code nx N fx = = no of pixels having the value x total number of image pixels Frequency of value x : Image histogram: A. Dermanis
Nx = nz Nx N Fx = = no of pixels having the value x The image histogram Nx = nz z =1 x Number of pixels having value x : Nx N Fx = = no of pixels having the value x total number of image pixels Cumulative frequency of value x : x Fx Image cumulative histogram: 1 128 255 A. Dermanis
Histogram Equalization Image with optimal contrast: all values of gray equally present f (x) = 1 255 f (x) = constant = 2p-1 Corresponding histogram f (x) : homogeneous histogram ! p = 8 (8-bit): F (x) = x 255 2p-1 Corresponding cumulative histogram F (x) : p = 8 (8-bit): A. Dermanis
Histogram Equalization Contrast Enhancement: Transformation of histogram to homogeneous one original cumulative histogram homogeneous Continuous case: Each pixel value x is replaced with a new value x such that F(x) = F (x ) Corresponding realistic discrete case A. Dermanis
Histogram Equalization Problems appearing in discrete histogram equalization: no values are mapped into some particular values of the new equalized histogram Different values are mapped into the same value A. Dermanis
Histogram Equalization Original image and histogram Resulting image and histogram Note departure from ideal homogeneous histogram ! A. Dermanis
Modifying an image so that its histogram F(x) is transformed Histogram matching Modifying an image so that its histogram F(x) is transformed into a prescribed histogram F (x ) (usually that of another image – Result: images of similar contrast) “target” cumulative histogram Each pixel value x is replaced with a new value x such that F(x) = F (x ) original cumulative histogram Same as histogram equalization with homogeneous histogram replaced by a given histogram A. Dermanis
Histogram matching The original image and its histogram The resulting image and its histogram The target image and its histogram Note that histograms are not exactly identical A. Dermanis
A & B values, selected so that xmin 1 & xmax L Linear streching Original image with pixel values limited to an interval xmin x xmax Resulting image with pixel values covering all possible values 0 x L (xmax – x) + L (x – xmin) x = xmax – xmin x x = Ax + B A & B values, selected so that xmin 1 & xmax L Application of a linear transformation A. Dermanis
Linear streching Original 3 bands of a Landsat TM image The same 3 bands after linear stretching of their histograms A. Dermanis
Saturated linear streching Linear transformation with (a > xmin) 1 and (b < xmax) L instead of xmin 1 and xmax L Saturation: (values 1 x < a) 1 (values b < x L) L A. Dermanis
Saturated linear streching Use of saturated linear stretching for the enhancement of particular features: Boat identification Original Resulting Bathymetry determination Original Resulting A. Dermanis