Presentation is loading. Please wait.

Presentation is loading. Please wait.

BYST Eh-1 DIP - WS2002: Enhancement in the Spatial Domain Digital Image Processing Bundit Thipakorn, Ph.D. Computer Engineering Department Image Enhancement.

Similar presentations


Presentation on theme: "BYST Eh-1 DIP - WS2002: Enhancement in the Spatial Domain Digital Image Processing Bundit Thipakorn, Ph.D. Computer Engineering Department Image Enhancement."— Presentation transcript:

1 BYST Eh-1 DIP - WS2002: Enhancement in the Spatial Domain Digital Image Processing Bundit Thipakorn, Ph.D. Computer Engineering Department Image Enhancement in the Spatial Domain

2 BYST Eh-2 DIP - WS2002: Enhancement in the Spatial Domain Image Enhancement  improve the quality of the image / or  emphasize particular aspects within the image Enhancement Input Image f(x,y) Output Image g(x,y) Application Specific Feedback

3 BYST Eh-3 DIP - WS2002: Enhancement in the Spatial Domain Enhancement The image enhancement can be performed in either: Spatial Domain: Directly manipulate on the pixels in an image. Frequency Domain: Modify the Fourier transform of an image. or Cont’d. The enhancement methods are application specific as illustrated in previous diagram. The enhancement process requires feedback from application.

4 BYST Eh-4 DIP - WS2002: Enhancement in the Spatial Domain Enhancement Cont’d. Image enhancement in spatial domain methods can be classified into five categories: 1. Point Operations: Each output pixel’s gray level depends only upon the gray level of the corresponding input pixel. 2. Global Operations: The global characteristics (statistics) of the image array are use to modify the pixel values.

5 BYST Eh-5 DIP - WS2002: Enhancement in the Spatial Domain Enhancement Cont’d. 4. Geometric Operations: The pixel values are modified according to the structural content of the image. 5. Temporal (Frame-Based) Operations: The resulting image is a combination of more than one unprocessed image. 3. Neighbourhood Operations: Data from the immediate neighbours is used to modify a pixel value.

6 BYST Eh-6 DIP - WS2002: Enhancement in the Spatial Domain Spatial Domain Methods g(x,y) = T[f(x,y)] Wheref(x,y)= the input image g(x,y)= the processed image T= an operator. Image enhancement in spatial domain can be expressed by the following expression: EnhancementCont’d.

7 BYST Eh-7 DIP - WS2002: Enhancement in the Spatial Domain The operator T is normally defined over some neighborhood of (x,y). EnhancementCont’d. y x Origin(0,0) (x,y) A traditional defined neighborhood of a point (x,y) A square subimage area centered at (x,y) which is usually called “mask (kernel, template, or window)”. Image f(x,y)

8 BYST Eh-8 DIP - WS2002: Enhancement in the Spatial Domain The center of the subimage is moved from pixel to pixel and the operator T is applied at each location (x,y) to yield the output g(x,y). EnhancementCont’d. y x Origin(0,0) (x,y) Image f(x,y) ConvolutionProcess Only the pixels in the area of the image spanned by the neighborhood are utilized.

9 BYST Eh-9 DIP - WS2002: Enhancement in the Spatial Domain Gray-Scale Modification Letr = the gray level of f(x,y) at x,y and s = the gray level of g(x,y) at x,y. s = M(r) Where M = a gray-level or mapping transformation function. Gray-scale modification is a type of point operations that will change the pixel’s values by a mapping equation as shown in the following:

10 BYST Eh-10 DIP - WS2002: Enhancement in the Spatial Domain That is, only one pixel is used and g(x,y) depends on the gray value at (x,y). Cont’d. Gray-Scale Modification

11 BYST Eh-11 DIP - WS2002: Enhancement in the Spatial Domain 1. Image Negative 1:1 Mapping Negative Mapping Input Gray Level Output Gray Level Let n be the number of gray level bits used S = 2 n - r Cont’d. Gray-Scale Modification

12 BYST Eh-12 DIP - WS2002: Enhancement in the Spatial Domain The primary operations applied to the gray scale of an image are to compress or stretch. Cont’d. Gray-Scale Modification Compress Uninterested gray-scale ranges. Stretch Gray-scale ranges containing desired information. Gray-scale compression or stretching can be performed by changing the slope of the mapping equations to be lower or greater than one, respectively. 2. Gray-Scale Compression and Stretching

13 BYST Eh-13 DIP - WS2002: Enhancement in the Spatial Domain Cont’d. Gray-Scale Modification Input Gray Level Output Gray Level 1:1 Mapping 255 255 0 a b Gray-Scale Compression Gray-Scale Stretching Slope > 1: Stretching Slope < 1: Compressing (0-b)(0-255) (0-255)(0-a) “a” and “b” < 255

14 BYST Eh-14 DIP - WS2002: Enhancement in the Spatial Domain Cont’d. Gray-Scale Modification Input Gray Level Output Gray Level Slope = 1 255 255 0 ab Gray-Scale Stretching Stretching gray-scales between a to b. Slope = 1 ab 255 255 Output Gray Level Input Gray Level 0 Gray-Scale Stretching Stretching with clipping at ends.

15 BYST Eh-15 DIP - WS2002: Enhancement in the Spatial Domain Cont’d. Gray-Scale Modification Input Gray Level Output Gray Level Slope = 1 255 255 0 a b Highlighting gray values between a to b. Slope = 1 ab 255 255 Output Gray Level Input Gray Level 0 Highlighting gray values between a to b and dimming others. Intensity-Level Slicing

16 BYST Eh-16 DIP - WS2002: Enhancement in the Spatial Domain To reduce contrast of brighter regions by using a logarithmic curve as the mapping function. 3. Logarithm Operator Cont’d. Gray-Scale Modification S = c log(|r|) or S = c log(1+|r|) rS Where c is the scaling constant which is selected so that the maximum output value is 255. M(r) A logarithmic transform stretches the lower values while compresses the higher values.

17 BYST Eh-17 DIP - WS2002: Enhancement in the Spatial Domain Cont’d. Gray-Scale Modification An original image. A enhanced image after applying the logarithm operator.

18 BYST Eh-18 DIP - WS2002: Enhancement in the Spatial Domain To enhance high intensity pixel values by using a exponential curve as the mapping function. 4. Exponential Operator Cont’d. Gray-Scale Modification S = c b r or S = c(b r - 1) Whereb = the basis rS M(r) A exponential transform stretches the higher values while compresses the lower values. c = the scaling constant

19 BYST Eh-19 DIP - WS2002: Enhancement in the Spatial Domain Cont’d. Gray-Scale Modification An original image. A enhanced image after applying the exponential operator.

20 BYST Eh-20 DIP - WS2002: Enhancement in the Spatial Domain An alternative method: “Raised to the Power” Cont’d. Gray-Scale Modification S = c r i In this alternative method, the input intensity “r” is a basis of the exponential mapping function. Hence the new pixel intensity value is equal to the input intensity value raised to the value of “i”. Ifi > 1 An exponential transform. i < 1 A logarithmic transform.

21 BYST Eh-21 DIP - WS2002: Enhancement in the Spatial Domain The brightness of the image can be easily adjusted by adding or subtracting f(x,y) with some constant gray-level (sliding the histogram to the bigger or the smaller gray-level). S = r + A ; S = r - A 5. Brightness Modification WhereA = the enhancement factor (constant). Cont’d. Gray-Scale Modification

22 BYST Eh-22 DIP - WS2002: Enhancement in the Spatial Domain To improve the contrast in an image by linearly stretching the intensity values that image contains to span within a desired range of values. Leta = the lowest gray level (0) b = the highest gray level (255) c = the lowest pixel value in the present image d = the highest pixel value in the present image. Therefore; S = [(r-c)(b-a)/(d-c)] + a 6. Contrast Stretching Cont’d. Gray-Scale Modification

23 BYST Eh-23 DIP - WS2002: Enhancement in the Spatial Domain A plot of the gray-level values versus the number of pixels at that value. # of pixels gray-level

24 BYST Eh-24 DIP - WS2002: Enhancement in the Spatial Domain Given an image f, the histogram of f over the gray levels ranged from 0 to L-1 is defined as: P(g) = N(g) M WhereP(g)= the histogram probability N(g)= the number of pixels at gray level g M= the total number of pixels in the image.

25 BYST Eh-25 DIP - WS2002: Enhancement in the Spatial Domain Note:0= White 255= Black Dark Image Bright Image

26 BYST Eh-26 DIP - WS2002: Enhancement in the Spatial Domain Note:0= White 255= Black Low- Contrast Image High- Contrast Image

27 BYST Eh-27 DIP - WS2002: Enhancement in the Spatial Domain Histogram processing (modification) is a type of global operations that will modify the dynamic range and contrast of the original image. Histogram processing (modification) is a type of global operations that will modify the dynamic range and contrast of the original image. The modification is performed by altering the histogram of the original image to have the desired shape. The modification is performed by altering the histogram of the original image to have the desired shape. Histogram modification can perform using non-linear or non-monotonic mapping functions. Histogram modification can perform using non-linear or non-monotonic mapping functions. Histogram Processing

28 BYST Eh-28 DIP - WS2002: Enhancement in the Spatial Domain 1. Histogram Equalization Ideally: The output image contains a uniform distribution of intensities ( a flat histogram). N(g) = Max { 0, Round ( ) -1} 2 l x c(g) m x n Wherel = the number of bits;m x n = the image resolution N(g) = the new intensity value c(g) = the cumulative pixel count up to old intensity value g Round( ) = a rounding to the nearest integer function. Cont’d. Histogram

29 BYST Eh-29 DIP - WS2002: Enhancement in the Spatial Domain Examples m=n=8 and l = 3 g fc(g)N(g) 0 1 2 3 4 5 6 7 8 22 20 2 30 2 8 2 0 80 50 52 54 62 64 3 5 5 6 7 7 7 Cont’d. Histogram

30 BYST Eh-30 DIP - WS2002: Enhancement in the Spatial Domain An original image. A enhanced image after applying the histogram equalization method. Cont’d. Histogram

31 BYST Eh-31 DIP - WS2002: Enhancement in the Spatial Domain 2. Histogram Specification (Matching) The output image contains a desired shape of the output intensity distribution (histogram). The output image contains a desired shape of the output intensity distribution (histogram). Histogram specification will map the intensity distribution of the original image into a desired intensity distribution by using a histogram equalized image as the intermediate stage. Histogram specification will map the intensity distribution of the original image into a desired intensity distribution by using a histogram equalized image as the intermediate stage. Cont’d. Histogram

32 BYST Eh-32 DIP - WS2002: Enhancement in the Spatial Domain Histogram specification can be performed as following steps:  Apply the histogram equalization to the original image (Row H in the following table).  Specify the histogram of the new image.  Apply the histogram equalization to the desired histogram in step 2 (Row S).  Map each value of row H to the closest value in row S and then using the corresponding row in O for the new value of gray level (Row M). Cont’d. Histogram

33 BYST Eh-33 DIP - WS2002: Enhancement in the Spatial Domain Examples: Step 1: Result of applying histogram equalization to the original image. Original Gray-Scale Value (O)Histogram Equalized Values (H) 0 1 2 3 4 5 6 7 1 2 4 4 6 6 7 7 Cont’d. Histogram

34 BYST Eh-34 DIP - WS2002: Enhancement in the Spatial Domain Examples: Step 2: The desired histogram. Gray-Scale ValueNumber of Pixels in Desired Histogram 0 1 2 3 4 5 6 7 1 5 10 15 20 0 0 0 Cont’d. Histogram

35 BYST Eh-35 DIP - WS2002: Enhancement in the Spatial Domain Examples: Step 3: Result of applying histogram equalization to the desired histogram. Gray-Scale ValueHistogram Equalized Values (S) 0 1 2 3 4 5 6 7 0 1 2 4 7 7 7 7 Cont’d. Histogram

36 BYST Eh-36 DIP - WS2002: Enhancement in the Spatial Domain Examples: Step 4: Mapping result OHSM 0 1 2 3 4 5 6 7 1 2 4 4 6 6 7 7 0 1 2 4 7 7 7 7 1 2 3 3 4 4 4 4 Cont’d. Histogram

37 BYST Eh-37 DIP - WS2002: Enhancement in the Spatial Domain Local Enhancement Histogram equalization and histogram specification previously discussed will enhance an image globally since pixels are modified by a transformation function based on the gray-level distribution over an entire image. Histogram equalization and histogram specification previously discussed will enhance an image globally since pixels are modified by a transformation function based on the gray-level distribution over an entire image. To enhance details over small areas, gray-level values within an image can be modified locally by applying histogram modification techniques to the image on a block- by-block basis (7x7, 15x15, etc.). This technique is called “local enhancement”. To enhance details over small areas, gray-level values within an image can be modified locally by applying histogram modification techniques to the image on a block- by-block basis (7x7, 15x15, etc.). This technique is called “local enhancement”.

38 BYST Eh-38 DIP - WS2002: Enhancement in the Spatial Domain Local Enhancement Cont’d.

39 BYST Eh-39 DIP - WS2002: Enhancement in the Spatial Domain Local Enhancement Original Image Image after global histogram equalization. Cont’d.

40 BYST Eh-40 DIP - WS2002: Enhancement in the Spatial Domain Local Enhancement Image after local histogram equalization (7x7). Image after local histogram equalization (15x15). Cont’d.

41 BYST Eh-41 DIP - WS2002: Enhancement in the Spatial Domain Adaptive Contrast Enhancement Modify the histogram by a transformation function based on the gray-level distribution over small areas (Local enhancement). Modify the histogram by a transformation function based on the gray-level distribution over small areas (Local enhancement). Adaptive Contrast Enhancement (ACE) method is based on the intensity mean and variance (or S.D.) of the pixel intensities in a neighborhood. Adaptive Contrast Enhancement (ACE) method is based on the intensity mean and variance (or S.D.) of the pixel intensities in a neighborhood. Let f(x,y) = an input image, g(x,y) = a new image, M = the global mean of f(x,y),

42 BYST Eh-42 DIP - WS2002: Enhancement in the Spatial Domain Adaptive Contrast Enhancement  (x,y) = the gray-level standard deviation (S.D.), Cont’d. m(x,y) = the gray-level mean, k 1 and k 2 = constants and 0 < k 1, k 2 < 1. Where  (x,y) and m(x,y) are calculated in a neighborhood centered at (x,y). The transformation function of ACE method is defined as follows:

43 BYST Eh-43 DIP - WS2002: Enhancement in the Spatial Domain Adaptive Contrast Enhancement Cont’d. The term is called the “local gain”.  (x,y) High contrast  (x,y) Low contrast Thus, areas with low contrast will have larger local gain.

44 BYST Eh-44 DIP - WS2002: Enhancement in the Spatial Domain Arithmetic/Logic Operations Image 1, …, n are normally the identical scenes but may be acquired at different times or through different spectral filters. Image 1, …, n are normally the identical scenes but may be acquired at different times or through different spectral filters. Arithmetic or Logic Operations Image 1 Image 2 Image n ResultImage

45 BYST Eh-45 DIP - WS2002: Enhancement in the Spatial Domain Arithmetic/Logic Operations Arithmetic/logic operations will operate on a pixel-by- pixel basis between two or more images. Arithmetic/logic operations will operate on a pixel-by- pixel basis between two or more images. The result image is a new image whose pixel at coordinates (x,y) is the result of applying arithmetic or logic operations to the pixels in the same location. The result image is a new image whose pixel at coordinates (x,y) is the result of applying arithmetic or logic operations to the pixels in the same location. Image subtraction and division are more widely used than image addition and multiplication. Image subtraction and division are more widely used than image addition and multiplication. The AND or OR operations are used for selecting subimages in an image (masking). The AND or OR operations are used for selecting subimages in an image (masking). Cont’d.

46 BYST Eh-46 DIP - WS2002: Enhancement in the Spatial Domain Arithmetic/Logic Operations Cont’d.

47 BYST Eh-47 DIP - WS2002: Enhancement in the Spatial Domain Arithmetic/Logic Operations Cont’d.


Download ppt "BYST Eh-1 DIP - WS2002: Enhancement in the Spatial Domain Digital Image Processing Bundit Thipakorn, Ph.D. Computer Engineering Department Image Enhancement."

Similar presentations


Ads by Google