Digital Image Analysis and Processing CPE 0907544 Image Enhancement – Part I Intensity Transformation Chapter 3 Sections: 3.1 – 3.3 Dr. Iyad Jafar
Outline What is Image Enhancement ? Background Intensity Transformation Functions Negatives Log and Inverse Log Power-Law Piecewise Transformation Graylevel and Bit Slicing Histogram Processing Equalization Specification Local Processing 2
What is Image Enhancement? The purpose of image enhancement is to process an image such that it is more suitable than the original image for a specific application The word specific is important, because algorithms developed for some images may not work for others There is no general theory for enhancement and the evaluation of its outcome is highly subjective Enhancement can be performed in Spatial domain: direct operation on the pixel values Frequency domain: modify the image frequency components (Ch. 4) 3
Background Spatial domain of the image is the set of pixels composing the image Enhancement in the spatial domain involves direct operation on the pixel intensities This can be expressed mathematically as g(x,y) = T[f(x,y)] f(x,y) is the input image g(x,y) is the output image T[ ] is an operator defined over some neighborhood of (x,y) Important Keep in mind that g(x,y) may take any value from the set of available gray levels only. Thus, when mapping we should assign the mapped value to the closest level 4
Background Defining the neighborhood around (x,y) Use a square/rectangular subimage that is centered at (x,y) Operation Move the center of the subimage from pixel to pixel and apply the operatorT at each location (x,y) to compute the output g(x,y) 5
Background The simplest form of the operator T is when the neighborhood size is 1x1 pixel . Accordingly, g(x,y) is only dependent on the value of f at (x,y) In this case, T is called the gray-level or intensity transformation function that can be represented as s = T(r) s is a variable denoting g(x,y) r is a variable denoting f(x,y) This is kind of processing is referred as point processing 6
Background Intensity transformation function examples T(r) reduces the number of T(r) performs contrast levels in the image to two stretching by mapping levels less than k to narrow range while those above k are mapped to wider range 7
Point Processing Example Thresholding Thresholding transformations are particularly useful for segmentation in which we want to isolate an object of interest from a background 1.0 r > threshold s = 0.0 r <= threshold 8
Basic Gray Level Transformations Mapping can be performed by mathematical substitution or lookup tables Some common functions are Linear (negative/identity) Logarithmic (log/inverse log) Power law (n th power/n th root) 9
Basic Gray Level Transformations Image Negatives Can be performed by using s = L – 1 – r where L-1 is the maximum intensity value 10
Basic Gray Level Transformations Log and inverse Log Transformations The general form of the log transformation s = clog (1+r) b b is the base Maps narrow range of low intensity levels to wider range and wide range of high intensity levels to narrower range Usually used to expand the values of dark pixels and compress the higher level values The general form of the inverse log cr s = b 1 Its operation is the opposite of the log transformation 11
Basic Gray Level Transformations Log Transformation Example It is very important in mapping wide dynamic ranges into narrow ones Fourier spectrum values in the range [0,1.5x10 6 ] transformed to [0,255] using log transformation s = log(1 + r) 12
Basic Gray Level Transformations Inverse Log Transformation Example e cr -1 13
Basic Gray Level Transformations Power-Law transformations The general form γ s = cr Power law is similar to log when gamma < 1 and similar to inverse log when gamma > 1 14
Basic Gray Level Transformations Power-Law transformations Gamma-correction Display devices have intensity-to-voltage response that is a power functions. Thus, images tend to be darker when displayed. Correction is needed using n th root before feeding the image to the monitor 15
Basic Gray Level Transformations Power-Law Transformation The images to the right shows a magnetic resonance (MR) image of a fractured human s = r 0.6 spine Different curves highlight different detail 16 s = r 0.4 s = r 0.3
Piecewise-Linear Transformations Can represent arbitrarily complex functions to achieve different results Contrast stretching r1 ≤ r2 and s1 ≤ s2 to preserve the order of gray levels The result depends on the values of r1, r2, s1, and s2 17
Piecewise-Linear Transformations Gray-level Slicing Used to highlight specific range of gray levels Two approaches 18
Piecewise-Linear Transformations Bit-plane Slicing Highlight the contribution of specific bits to the appearance of the image Each pixel value is represented by a set of bits Lower bits correspond to fine details while higher bits correspond to the global visual content Useful in image compression ! 19
Piecewise-Linear Transformations Bit-plane Slicing - example Plane 0 Plane 1 Plane 3 Plane 4 Plane 2 Plane 5 Plane 6 Plane 7 20
Piecewise-Linear Transformations Bit-plane Slicing - example Planes 7 & 6 Planes 7,6,5 Planes 7,6,5,4 21
Piecewise-Linear Transformations Bit-plane Slicing - example Plane 6 Plane 7 Plane 5 Plane 3 Plane 4 22 Plane 1 Plane 0 Plane 2
Histogram Processing For an image with gray levels in [0,L-1] and MxN pixels, the histogram is a discrete function given by h( r ) n k k where r k is the k th intensity value and n k is the number of pixels in the image with intensity r k It is a common practice to normalize the histogram function by the number of pixels in the image by n k p( r ) k MN The normalized histogram can be used as an estimate of the probability density function of the image Histograms are widely used in image processing: enhancement, compression, segmentation … 23
Histogram Processing For enhancement, histograms can be used to infer the type of image quality: dark, bright, low or high contrast Low Contrast Dark Image High Contrast Bright Image 24
Histogram Equalization It is quite acceptable that high contrast images have flat histograms (uniform distribution) Histogram equalization attempts to transform the original histogram into a flat one for the goal of better contrast In the following, we derive the transformation function that achieves this task 25
Histogram Equalization Let r be a continuous variable that represents the intensity values in the range [0,L-1] A valid transformation function for enhancement purposes s = T(r) should satisfy T(r) is monotonically increasing in the interval 0 ≤ r ≤ L-1 T(r) is bounded by [0,L-1] for all values of r The inverse transformation function that maps s back to r 1 r T ( s ) requires that T(r) to be strictly monotonically increasing 26
Histogram Equalization Examples of transformation functions Monotonically Increasing Strictly monotonically increasing 27
Histogram Equalization Consider the gray level intensity represented by r as a random variable in the interval [0,L-1] We can use the normalized histogram p r (r) as the probability density function for r If a transformation function s = T(r) is used to map the pixels into s in the range [0,L-1], then the following relation holds dr p ( s ) p ( r ) ds s r 1 r T ( s ) where p s (s) is the normalized histogram of the output image 28
Histogram Equalization Now, if we know that the output image has a flat histogram, i.e. 1 p ( s ) , s [0,L-1] s L 1 we can substitute in the equation in the previous slide and solve for s by integrating both sides This gives the desired transformation function s=T(r) that performs histogram equalization r s T( r ) ( L 1 ) p ( w )dw r 0 For digital images, the transformation function is simply r r k k (L-1) s T( r ) (L-1) p ( r ) n k r w w MN 29 w 0 w 0
Histogram Equalization The function given before maps the image histogram into a flat histogram regardless of its original shape Example 3.1: consider an image with intensity distribution given by 2 r p ( r ) , r [0,L-1] r 2 ( L 1 ) show that applying the histogram equalization function transforms this histogram into a flat one. 30
Histogram Equalization 2 r p ( r ) , r [0,L-1] Example 3.1: r 2 ( L 1 ) dr p ( s ) p ( r ) ds s r 1 r T ( s ) 31
Recommend
More recommend