chapter3 image enhancement in the spatial domain

64
1 Chapter3 Chapter3 Image Enhancement Image Enhancement in the Spatial Domain in the Spatial Domain 3.0 Introduction 3.0 Introduction 3.1 Background 3.1 Background 3.2 Some Basic Gray Level Transformations 3.2 Some Basic Gray Level Transformations 3.3 Histogram Processing 3.3 Histogram Processing 3.4 Enhancement Using Arimethic/Logic 3.4 Enhancement Using Arimethic/Logic Operations Operations 3.5 Basics of Spatial Filtering 3.5 Basics of Spatial Filtering 3.6 Smoothing Spatial Filters 3.6 Smoothing Spatial Filters 3.7 Sharpening Spatial Filters 3.7 Sharpening Spatial Filters 3.8 Combining Spatial Enhancement Methods 3.8 Combining Spatial Enhancement Methods

Upload: sophie

Post on 15-Jan-2016

106 views

Category:

Documents


3 download

DESCRIPTION

Chapter3 Image Enhancement in the Spatial Domain. 3.0 Introduction 3.1 Background 3.2 Some Basic Gray Level Transformations 3.3 Histogram Processing 3.4 Enhancement Using Arimethic/Logic Operations 3.5 Basics of Spatial Filtering 3.6 Smoothing Spatial Filters - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter3 Image Enhancement  in the Spatial Domain

11

Chapter3Chapter3Image Enhancement Image Enhancement in the Spatial Domainin the Spatial Domain

3.0 Introduction3.0 Introduction 3.1 Background3.1 Background 3.2 Some Basic Gray Level Transformations3.2 Some Basic Gray Level Transformations 3.3 Histogram Processing3.3 Histogram Processing 3.4 Enhancement Using Arimethic/Logic 3.4 Enhancement Using Arimethic/Logic

OperationsOperations 3.5 Basics of Spatial Filtering 3.5 Basics of Spatial Filtering 3.6 Smoothing Spatial Filters3.6 Smoothing Spatial Filters 3.7 Sharpening Spatial Filters3.7 Sharpening Spatial Filters 3.8 Combining Spatial Enhancement Methods3.8 Combining Spatial Enhancement Methods

Page 2: Chapter3 Image Enhancement  in the Spatial Domain

22

3.0 INTRODUCTION3.0 INTRODUCTION

1. 1. ObjectiveObjective to process an image so that the result is more to process an image so that the result is more

suitable for specific applications.suitable for specific applications.2. Categories2. Categories

a. spatial domain methods.a. spatial domain methods.b. frequency domain methods.b. frequency domain methods.c. combinations of above two types.c. combinations of above two types.

Page 3: Chapter3 Image Enhancement  in the Spatial Domain

33

3.1 BACKGROUND3.1 BACKGROUND

1. 1. Operate directly on an image f by the Operate directly on an image f by the following way:following way:

g(x, y) = T [ f (x, y)]g(x, y) = T [ f (x, y)]

where g is the processed image; and T is an where g is the processed image; and T is an operator over an n operator over an n n neighborhood of f n neighborhood of f

For simplicity in notationFor simplicity in notation ::S = TS = T (( rr))

r and s is the gray level of fr and s is the gray level of f (( x,yx,y )) and gand g (( x,yx,y ))

Page 4: Chapter3 Image Enhancement  in the Spatial Domain

44

3.1 BACKGROUND3.1 BACKGROUND

Page 5: Chapter3 Image Enhancement  in the Spatial Domain

55

3.1 BACKGROUND3.1 BACKGROUND

2. Point processing -- for n = 1, i.e.,2. Point processing -- for n = 1, i.e.,neighborhood = the pixel itselfneighborhood = the pixel itself

3. Mask processing -- also called filtering; 3. Mask processing -- also called filtering; for n for n 1; neighborhood = n 1; neighborhood = n n pixels; n pixels;

using masks.using masks.

Page 6: Chapter3 Image Enhancement  in the Spatial Domain

66

4.2 4.2 ENHANCEMENT BY POINT ENHANCEMENT BY POINT PROCESSINGPROCESSING

4.2.1 4.2.1 Some Simple Intensity Some Simple Intensity TransformationsTransformations

4.2.2 Histogram Processing4.2.2 Histogram Processing4.2.3 Image Subtraction4.2.3 Image Subtraction4.2.4 Image Averaging4.2.4 Image Averaging

Page 7: Chapter3 Image Enhancement  in the Spatial Domain

77

4.2.1 4.2.1 Some Simple Intensity Some Simple Intensity Transformations…(1)Transformations…(1)

1. 1. Image negativesImage negativesgiven a pixel gray level ( g. l. ) r, output pixel given a pixel gray level ( g. l. ) r, output pixel

g. l. s isg. l. s is

rL

LrrTs

)1(

1)(

r

s

L-1

L-10

L-1 = largest g. l.

T

Page 8: Chapter3 Image Enhancement  in the Spatial Domain

88

4.2.1 4.2.1 Some Simple Intensity Some Simple Intensity Transformations…(2)Transformations…(2)

2. 2. Contrast stretchingContrast stretching(1) Stretching is useful for improving image (1) Stretching is useful for improving image

contrast.contrast.(2) General transformation diagram.(2) General transformation diagram.

r

s

L-1

L-10

(r2,s2)

(r1,s1)L-1 = largest g. l.

Page 9: Chapter3 Image Enhancement  in the Spatial Domain

99

4.2.1 4.2.1 Some Simple Intensity Some Simple Intensity Transformations…(3)Transformations…(3)

(3) (3) cases :cases :a. no change -- if r1 = s1 , r2 = s2 .a. no change -- if r1 = s1 , r2 = s2 .b. thresholding -- if r1 = r2, s1 = 0, and s2 = L-1 ;b. thresholding -- if r1 = r2, s1 = 0, and s2 = L-1 ;

threshod value = r1 = r2.threshod value = r1 = r2.c. stretching -- if r1c. stretching -- if r1 r2 & s1 r2 & s1 s2 ( to keep s2 ( to keep

monotonicity of transformation ) monotonicity of transformation ) d. Why dies stretching improve image contrast?d. Why dies stretching improve image contrast?e. How to stretch is problem - dependente. How to stretch is problem - dependent

Page 10: Chapter3 Image Enhancement  in the Spatial Domain

1010

4.2.1 4.2.1 Some Simple Intensity Some Simple Intensity Transformations…(4)Transformations…(4)

L-1

L-10

s

r r0

(r2, s2)=(r0,L-1)

(r1, s1)=(r0,0)

S=T(r)

T(C)

A B C

T(B)

T(A)

0

L-1 = largest g. l.Mappings:A=>T(A)(longer => smaller)

B => T(B)(smaller => larger )CONTRAST IMPROVED)

C => T(C)(larger => smaller)

Page 11: Chapter3 Image Enhancement  in the Spatial Domain

1111

4.2.1 4.2.1 Some Simple Intensity Some Simple Intensity Transformations…(5)Transformations…(5)

3. 3. Compression of dynamic rangesCompression of dynamic ranges (1) Gray levels may be out of the display (1) Gray levels may be out of the display

range after certain transformations.range after certain transformations. (2) One way to compress is (2) One way to compress is

S = T( r ) = c log(1+ | r | )S = T( r ) = c log(1+ | r | )

where c is a constant to make s to lie between 0 where c is a constant to make s to lie between 0 and L-1and L-1

Page 12: Chapter3 Image Enhancement  in the Spatial Domain

1212

4.2.1 4.2.1 Some Simple Intensity Some Simple Intensity Transformations…(6)Transformations…(6)

4. 4. Gray level slicing Gray level slicing (1) Highlighting a specific g. l. range(1) Highlighting a specific g. l. range (2) Useful for many applications.(2) Useful for many applications. (3) Two approaches:(3) Two approaches:

a. use high values for desired ranges and low a. use high values for desired ranges and low values for others;values for others;

b. use high values for desired ranges and keep the b. use high values for desired ranges and keep the values for others.values for others.

(4) See Fig 4.7 (4) See Fig 4.7

Page 13: Chapter3 Image Enhancement  in the Spatial Domain

1313

Fig 4.7

Page 14: Chapter3 Image Enhancement  in the Spatial Domain

1414

4.2.1 4.2.1 Some Simple Intensity Some Simple Intensity Transformations…(7)Transformations…(7)

5. 5. Bit-plane slicingBit-plane slicing (1) Highlighting “ contributions made by (1) Highlighting “ contributions made by

specific bits to image appearance.specific bits to image appearance. (2) More important information is included in (2) More important information is included in

higher- order bit planes; details in others (see higher- order bit planes; details in others (see Fig. 4.8 )Fig. 4.8 )

(3) Bit - plane 7 ( highest - order ) = result of (3) Bit - plane 7 ( highest - order ) = result of thresholding with threshold = 128thresholding with threshold = 128

(4) See Fig. 4.9 (4) See Fig. 4.9

Page 15: Chapter3 Image Enhancement  in the Spatial Domain

1515

Page 16: Chapter3 Image Enhancement  in the Spatial Domain

1616

Page 17: Chapter3 Image Enhancement  in the Spatial Domain

1717

Page 18: Chapter3 Image Enhancement  in the Spatial Domain

1818

4.2.24.2.2Histogram Processing…(1)Histogram Processing…(1)

1. 1. Definition and properties of histogramDefinition and properties of histogram (1) the histogram of a given image f is a (1) the histogram of a given image f is a

functionfunctionP( rP( rk k ) = n) = nk k / n/ n

where rwhere rkk = the kth g. l.; = the kth g. l.;

nnkk = the no. of pixels with g.l. r = the no. of pixels with g.l. rkk

n = the total no. of pixels in f.n = the total no. of pixels in f.

(2) Diagram of histogram (2) Diagram of histogram ….

Nk/n

1 2 3 k L-1r

Page 19: Chapter3 Image Enhancement  in the Spatial Domain

1919

4.2.24.2.2Histogram Processing…(2)Histogram Processing…(2)

(3) (3) Concept :Concept :

histogram = p.d.f ( probability density histogram = p.d.f ( probability density function )function )

(4) A histogram gives the global appearance (4) A histogram gives the global appearance of an image .of an image .

(5) Histograms of images with high and low (5) Histograms of images with high and low contrasts (see Fig. 4.10 )contrasts (see Fig. 4.10 )

Page 20: Chapter3 Image Enhancement  in the Spatial Domain

2020

Page 21: Chapter3 Image Enhancement  in the Spatial Domain

2121

4.2.24.2.2Histogram Processing…(3)Histogram Processing…(3)

2. 2. Histogram equalizationHistogram equalization (1) Equalization transformation of a given (1) Equalization transformation of a given

image f :image f :

where Pwhere Prr(w) is the histogram of f(w) is the histogram of f

(2) S above is exactly the c. d. f. of r ( c. d. f. (2) S above is exactly the c. d. f. of r ( c. d. f. = cumulative distribution function )= cumulative distribution function )

r

r dwwPrTs0

)()( 10,10 sr

Page 22: Chapter3 Image Enhancement  in the Spatial Domain

2222

4.2.24.2.2Histogram Processing…(4)Histogram Processing…(4)

(3) (3) It can be shown by probability theory (see It can be shown by probability theory (see textbook) that the new image with g. l. s has a textbook) that the new image with g. l. s has a uniform distribution, i.e.,uniform distribution, i.e.,

(4) the transformation illustration(4) the transformation illustrationPr(r)

r

Ps(s)

S

Equalization

Image with low contrast Image with higher contrast

1)( sPs 10 s

Page 23: Chapter3 Image Enhancement  in the Spatial Domain

2323

4.2.24.2.2Histogram Processing…(5)Histogram Processing…(5)

(5) (5) Read the example in pp. 176-177.Read the example in pp. 176-177. (6) Histogram equalization is also called (6) Histogram equalization is also called

histogram flatting or linearization.histogram flatting or linearization. (7) Discrete form of histogram equalization(7) Discrete form of histogram equalization

k

j

k

j

jjrkk n

nrPrTs

0 0

)()(

Page 24: Chapter3 Image Enhancement  in the Spatial Domain

2424

4.2.24.2.2Histogram Processing…(6)Histogram Processing…(6)

(8) (8) A computation exampleA computation examplek 0 1 2 3 4 5 6 7

pixels 0 1 2 6 8 6 1 0r 0 1 2 3 4 5 6 7 x(1/8)

Pr® 0 1 2 6 8 6 1 0 x(1/24)s 0 1 3 9 17 23 24 24 x(1/24)

1 2 3 4 5 6 7 1 3 9 17 23 24

Page 25: Chapter3 Image Enhancement  in the Spatial Domain

2525

4.2.24.2.2Histogram Processing…(7)Histogram Processing…(7)

(9) (9) A major advantage of histogram A major advantage of histogram equalization for image contrast enhancement equalization for image contrast enhancement is that it can be applied automatically.is that it can be applied automatically.

(10) See Fig. 4.14 for a real example.(10) See Fig. 4.14 for a real example.3. Histogram specification3. Histogram specification

See textbookSee textbook4. Local enhancement4. Local enhancement

See textbookSee textbook

Page 26: Chapter3 Image Enhancement  in the Spatial Domain

2626

4.2.34.2.3Image SubtractionImage Subtraction

1. 1. Computes the difference g of two Computes the difference g of two images f and h :images f and h :

2. For application example, see Fig. 4.17 2. For application example, see Fig. 4.17

),(),(),( yxhyxfyxg

Page 27: Chapter3 Image Enhancement  in the Spatial Domain

2727

4.2.44.2.4Image AveragingImage Averaging

1. 1. Reduces noise by averaging several Reduces noise by averaging several copies of and identical imagecopies of and identical image

2. Method :2. Method :

where gwhere gii(x, y) is one of copies of origin image(x, y) is one of copies of origin image

3. Why work ? Noise standard deviation 3. Why work ? Noise standard deviation can be reduced to 1/n of origin can be reduced to 1/n of origin

4. See Fig. 4.184. See Fig. 4.18

M

ii yxg

Myxg ),(

1),(

Page 28: Chapter3 Image Enhancement  in the Spatial Domain

2828

4.34.3Spatial FilteringSpatial Filtering

4.3.1 4.3.1 BackgroundBackground4.3.2 Smoothing Filtering4.3.2 Smoothing Filtering4.3.3 Sharpening Filtering4.3.3 Sharpening Filtering

Page 29: Chapter3 Image Enhancement  in the Spatial Domain

2929

4.3.1 4.3.1 Background…(1)Background…(1)

1. 1. Spatial filtering is also called mask processing.Spatial filtering is also called mask processing. 2. Masks ( also called spatial filters ) are used2. Masks ( also called spatial filters ) are used 3. High - frequency components in images:3. High - frequency components in images:

noise, edges, sharp details, etc.noise, edges, sharp details, etc. 4. Low - frequency components in images:4. Low - frequency components in images:

uniform regions, slow - changing background g. l., uniform regions, slow - changing background g. l., etc.etc.

5. Type of spatial filtering :5. Type of spatial filtering : (1) lowpass filtering(1) lowpass filtering

useful for image blurring (smoothing)useful for image blurring (smoothing)

Page 30: Chapter3 Image Enhancement  in the Spatial Domain

3030

4.3.1 4.3.1 Background…(2)Background…(2)

(2) (2) Highpass filteringHighpass filteringuseful for image sharpeninguseful for image sharpening

(3) Bandpass filtering(3) Bandpass filteringmostly used in image restorationmostly used in image restoration

6. See Fig 4.19 for the above 3 types.6. See Fig 4.19 for the above 3 types.7. Linear mask operation :7. Linear mask operation :

Page 31: Chapter3 Image Enhancement  in the Spatial Domain

3131

4.3.1 4.3.1 Background…(2)Background…(2)

Operation : replace z5 by Operation : replace z5 by R = MR = MN = z1N = z1w1 + z2w1 + z2w2 +……. + z9w2 +……. + z9w9w9

8. Nonlinear mask operation :8. Nonlinear mask operation :R is computed nonlinearly using information of the R is computed nonlinearly using information of the

neighborhood of current pixel as well as the mask. neighborhood of current pixel as well as the mask.

w1 w2 w3w4 w5 w6w7 w8 w9

z1 z2 z3z4 z5 z6z7 z8 z9

Mask M Neighborhood N

Z5 = g. l. of current pixel

Page 32: Chapter3 Image Enhancement  in the Spatial Domain

3232

4.3.24.3.2Smoothing Filters…(1)Smoothing Filters…(1)

1. 1. Used for image blurring & noise Used for image blurring & noise reduction.reduction.

2. Useful for removing small details and 2. Useful for removing small details and bridging small gaps in lines or curves.bridging small gaps in lines or curves.

3. Lowpass spatial filtering :3. Lowpass spatial filtering : (1) Mask for 3(1) Mask for 33 neighborhood3 neighborhood

9

1M

1 1 11 1 11 1 1

Page 33: Chapter3 Image Enhancement  in the Spatial Domain

3333

4.3.24.3.2Smoothing Filters…(2)Smoothing Filters…(2)

(2) (2) Operation -- replace z5 byOperation -- replace z5 by

(3) Also called neighborhood averaging(3) Also called neighborhood averaging (4) See Fig. 4.22 for effect(4) See Fig. 4.22 for effect

4. Median filtering4. Median filtering (1) Reducing noise without blurring images (1) Reducing noise without blurring images

9

19

1

iii zwNMR

Page 34: Chapter3 Image Enhancement  in the Spatial Domain

3434

4.3.24.3.2Smoothing Filters…(3)Smoothing Filters…(3)

(2) (2) Operation -- Operation -- replace g. l. at (x, y) with the median of all the g. l. replace g. l. at (x, y) with the median of all the g. l.

of neighborhood.of neighborhood.

(3) Meaning of median(3) Meaning of medianvalue r such that value r such that

(i.e., r = (1/2)tile of the p.d.f. )(i.e., r = (1/2)tile of the p.d.f. )

2

1)(

0

dwwPr

r

Area = 1/2

x

P(x)

r = median

Page 35: Chapter3 Image Enhancement  in the Spatial Domain

3535

4.3.24.3.2Smoothing Filters…(4)Smoothing Filters…(4)

(4) (4) An example:An example:

givengiven

g. l. z5 = 15 is replaced by median = 20g. l. z5 = 15 is replaced by median = 20

(5) For effect of median filtering, see Fig. 4.23(5) For effect of median filtering, see Fig. 4.23

10 20 2020 15 2020 25 99

Page 36: Chapter3 Image Enhancement  in the Spatial Domain

3636

4.3.34.3.3Sharpening Filters…(1)Sharpening Filters…(1)

1. 1. ObjectiveObjectivehighlighting or enhancing fine details in highlighting or enhancing fine details in

images. images. 2. Applications2. Applications

(1) electronic printing;(1) electronic printing; (2) medical imaging;(2) medical imaging; (3)industrial inspection;(3)industrial inspection; (4) target detection;(4) target detection;etc.etc.

Page 37: Chapter3 Image Enhancement  in the Spatial Domain

3737

4.3.34.3.3Sharpening Filters…(2)Sharpening Filters…(2)

3. 3. Basic highpass spatial filtering (HPSF)Basic highpass spatial filtering (HPSF) (1) Mask for 3(1) Mask for 33 neighborhood3 neighborhood

(2) See Fig. 4.25 for effect of filtering(2) See Fig. 4.25 for effect of filtering 4. High best filtering4. High best filtering

(1) Also called high-frequency emphasis filtering.(1) Also called high-frequency emphasis filtering.

9

1M

-1 -1 -1-1 8 -1-1 -1 1

Page 38: Chapter3 Image Enhancement  in the Spatial Domain

3838

4.3.34.3.3Sharpening Filters…(3)Sharpening Filters…(3)

(2) (2) Method :Method :

high-best = A high-best = A (original) - lowpass (original) - lowpass

== (A-1)(original) + original - lowpass(A-1)(original) + original - lowpass

= (A-1)(original) + highpass= (A-1)(original) + highpasswhere A is a selected weight.where A is a selected weight.

(3) Note that part of the original image is added back.(3) Note that part of the original image is added back.(4) Equivalent mask(4) Equivalent mask

(5) See Fig. 4.27 (A=1.1 is enough)(5) See Fig. 4.27 (A=1.1 is enough)

9

1M

-1 -1 -1-1 w -1-1 -1 1

Where w=9A-1(A =1 basic HPSF)

Page 39: Chapter3 Image Enhancement  in the Spatial Domain

3939

4.3.34.3.3Sharpening Filters…(4)Sharpening Filters…(4)

5. 5. Derivative filtersDerivative filters (1) (1) Concept -Concept -

(2) The most common differentiation operation (2) The most common differentiation operation is the gradientis the gradient

Averaging(integration)

Difference(differentiation)

Blurring Sharpening

Page 40: Chapter3 Image Enhancement  in the Spatial Domain

4040

4.3.34.3.3Sharpening Filters…(5)Sharpening Filters…(5)

(3) (3) GradientGradienta. definition -- the gradient of a function f at a pixel a. definition -- the gradient of a function f at a pixel

(x(x00, y, y00) is) is

b. magnitude of gradient --b. magnitude of gradient --

00

),(

yxy

fx

f

yxf

2/1

22 )()(),(

y

f

x

fyxf

Page 41: Chapter3 Image Enhancement  in the Spatial Domain

4141

4.3.34.3.3Sharpening Filters…(6)Sharpening Filters…(6)

(4) (4) Approximation of gradient magnitude :Approximation of gradient magnitude :a. Assume the neighborhood (nbhd) g. l. of the a. Assume the neighborhood (nbhd) g. l. of the

pixel at (x, y) arepixel at (x, y) are

b. in continuous formb. in continuous form

Nz1 z2 z3z4 z5 z6z7 z8 z9

With g. l. at (x, y) = z5

2/122 )65()85( zzzzf or

2/122 )86()95( zzzzf

Page 42: Chapter3 Image Enhancement  in the Spatial Domain

4242

4.3.34.3.3Sharpening Filters…(7)Sharpening Filters…(7)

C. in absolute difference form :C. in absolute difference form :

d. Roberts operators for 2 d. Roberts operators for 2 2 nbhd : 2 nbhd :

operation = | N operation = | N MR1 | + | N MR1 | + | N MR2 | = | z5-z9 | + | z6 - MR2 | = | z5-z9 | + | z6 - z8 | z8 |

6585 zzzzf or

8695 zzzzf

1 00 -1

0 1-1 0

MR1 MR2

Page 43: Chapter3 Image Enhancement  in the Spatial Domain

4343

4.3.34.3.3Sharpening Filters…(8)Sharpening Filters…(8)

d. Prewitt operators for 3 d. Prewitt operators for 3 3 nbhd : 3 nbhd :

operation = | N operation = | N MP1 | + | N MP1 | + | N MP2 | MP2 |

= | (z7+z8+z9) - (z1+z2+z3) | = | (z3+z6+z9) - (z1+z4+z7) |= | (z7+z8+z9) - (z1+z2+z3) | = | (z3+z6+z9) - (z1+z4+z7) |e. Sobel operators for 3 e. Sobel operators for 3 3 nbhd : 3 nbhd :

operation = | N operation = | N MS1 | + | N MS1 | + | N MS2 | MS2 |

= | (z7+2= | (z7+2z8+z9) - (z1+2z8+z9) - (z1+2z2+z3) | z2+z3) |

= | (z3+2= | (z3+2z6+z9) - (z1+2z6+z9) - (z1+2z4+z7) |z4+z7) |

-1 -1 -10 0 01 1 1

-1 0 1-1 0 1-1 0 1

MP1 MP2

-1 -2 -10 0 01 2 1

-1 0 1-2 0 2-1 0 1

MS1 MS2

Page 44: Chapter3 Image Enhancement  in the Spatial Domain

4444

4.4 4.4 Enhancement Enhancement in Frequency Domainin Frequency Domain

4.4.1 4.4.1 Lowpass FilteringLowpass Filtering4.4.2 Highpass Filtering4.4.2 Highpass Filtering4.4.3 Homomorphic Filtering4.4.3 Homomorphic Filtering

Page 45: Chapter3 Image Enhancement  in the Spatial Domain

4545

4.4.1 4.4.1 Lowpass Filtering…(1)Lowpass Filtering…(1)

1. 1. Use Use image blurring ( smoothing )image blurring ( smoothing )

2. Goal 2. Goal Want to find a transfer function H(u, v) in the Want to find a transfer function H(u, v) in the

frequency domain to attenuate the high frequency domain to attenuate the high frequency in the FT F(u, v) of a given image f frequency in the FT F(u, v) of a given image f using the inverse FTusing the inverse FT

)],(),([),( 1 vuFvuHFyxg

Page 46: Chapter3 Image Enhancement  in the Spatial Domain

4646

4.4.1 4.4.1 Lowpass Filtering…(2)Lowpass Filtering…(2)

3. 3. Ideal lowpass filter (ILPF)Ideal lowpass filter (ILPF) (1) Definition --(1) Definition --

H(u, v) = 1 H(u, v) = 1 if D(u, v) if D(u, v) D D00

= 0= 0 otherwiseotherwise

where D(u, v) = distance from (0, 0) to (u, v);where D(u, v) = distance from (0, 0) to (u, v);

and Dand D00 is a constant ( called cutoff frequency ) is a constant ( called cutoff frequency )

(2) See Fig 4.30 for the filter shape in 3-D and 2-D(2) See Fig 4.30 for the filter shape in 3-D and 2-D (3) The ILPF cannot be implemented by analog (3) The ILPF cannot be implemented by analog

hardware ( but can be implemented by software )hardware ( but can be implemented by software ) (4) Before seeing effects of the ILPF, we need to review (4) Before seeing effects of the ILPF, we need to review

more properties of the FT first.more properties of the FT first.

Page 47: Chapter3 Image Enhancement  in the Spatial Domain

4747

4.4.1 4.4.1 Lowpass Filtering…(3)Lowpass Filtering…(3)

4. 4. Additional review of the Fourier transform Additional review of the Fourier transform See sec.3.2~3.4 for FT, DFT, FFTSee sec.3.2~3.4 for FT, DFT, FFTSee Fig. 4.31 for an example of Fourier spectrum ( or See Fig. 4.31 for an example of Fourier spectrum ( or

simply called spectrum )simply called spectrum ) 5. See Fig. 4.32 for effects of applying the ILPF 5. See Fig. 4.32 for effects of applying the ILPF

using different cutoff frequencies.using different cutoff frequencies. 6. The ILPF produces ringing effects; see Fig. 6. The ILPF produces ringing effects; see Fig.

4.32(d) for an example; and see Fig. 4.33 for the 4.32(d) for an example; and see Fig. 4.33 for the reason. Note Fig. 4.33(a) is equivalent to the top reason. Note Fig. 4.33(a) is equivalent to the top view of a 2-D sinc function.view of a 2-D sinc function.

Page 48: Chapter3 Image Enhancement  in the Spatial Domain

4848

4.4.1 4.4.1 Lowpass Filtering…(4)Lowpass Filtering…(4)

7. 7. Butterworth lowpass filter ( BLPF )]Butterworth lowpass filter ( BLPF )] (1) A BLPF of order n with cutoff frequency at D(1) A BLPF of order n with cutoff frequency at D00 is is

defined asdefined as

where A = 1 or 0.414where A = 1 or 0.414 (2) See Fig. 4.34 for the shape of the BLPF.(2) See Fig. 4.34 for the shape of the BLPF. (3) See Fig. 4.35 for the effects of applying the BLPF with (3) See Fig. 4.35 for the effects of applying the BLPF with

n = 1 for 5 Dn = 1 for 5 D00 values. values.

8. The BLPF produces no ringing effect due to the 8. The BLPF produces no ringing effect due to the smoothness of its transfer function where A=1 or smoothness of its transfer function where A=1 or 0.414 0.414

nDvuDAvuH 2

0),(1

1),(

Page 49: Chapter3 Image Enhancement  in the Spatial Domain

4949

4.4.2 4.4.2 Highpass Filtering…(1)Highpass Filtering…(1)

1. 1. Use Use Image sharpeningImage sharpening

2. Ideal highpass filter (IHPF)2. Ideal highpass filter (IHPF)(1) Transfer function(1) Transfer function

H(u, v) = 0 H(u, v) = 0 if D(u, v) if D(u, v) D D00

= 1= 1 otherwiseotherwise

(2) See Fig. 4.37 for shapes of the IHPF.(2) See Fig. 4.37 for shapes of the IHPF.

Page 50: Chapter3 Image Enhancement  in the Spatial Domain

5050

4.4.2 4.4.2 Highpass Filtering…(2)Highpass Filtering…(2)

3.3.Butterworth highpass filter (BHPF):Butterworth highpass filter (BHPF): (1) (1) Transfer functionTransfer function

where A = 1 or 0.414where A = 1 or 0.414 (2) See Fig. 4.38 for shapes of the BHPF. (2) See Fig. 4.38 for shapes of the BHPF.

4.4.3 Homomorphic Filtering4.4.3 Homomorphic Filtering 4.5 Generation of spatial masks from frequency 4.5 Generation of spatial masks from frequency

domain specificationsdomain specificationsRead the textbookRead the textbook

nvuDDAvuH 2

0 ),(1

1),(

Page 51: Chapter3 Image Enhancement  in the Spatial Domain

5151

4.64.6Color Image ProcessingColor Image Processing

4.6.0 4.6.0 IntroductionIntroduction4.6.1 Color fundamentals4.6.1 Color fundamentals4.6.2 Color models4.6.2 Color models4.6.3 Pseudo-color image processing4.6.3 Pseudo-color image processing4.6.4 Full color image processing4.6.4 Full color image processing

Page 52: Chapter3 Image Enhancement  in the Spatial Domain

5252

4.6.04.6.0IntroductionIntroduction

1. 1. MotivationMotivation (1) Color is a powerful descriptor for automated image (1) Color is a powerful descriptor for automated image

analysis.analysis. (2) The human eye can discern thousands of color (2) The human eye can discern thousands of color

shades and intensities ( but about only a dozen of shades and intensities ( but about only a dozen of grey levels )grey levels )

2. Study areas2. Study areas (1) full color image processing(1) full color image processing

still in infancystill in infancy (2) Pseudo - color image processing(2) Pseudo - color image processing

assigning color shades to monochrome intensity imagesassigning color shades to monochrome intensity images

Page 53: Chapter3 Image Enhancement  in the Spatial Domain

5353

4.6.14.6.1Color Fundamentals…(1)Color Fundamentals…(1)

1. 1. Colors of lightColors of light (1) Primary -- red (R), green (G), and blue (B)(1) Primary -- red (R), green (G), and blue (B) (2) Secondary -- magenta (R+B),(2) Secondary -- magenta (R+B),

cyancyan (G+B)(G+B)

yellowyellow (R+G)(R+G) (3) See plate III(a) for illustration.(3) See plate III(a) for illustration.

2. Colors of pigments (colorants) --2. Colors of pigments (colorants) -- (1) Primary -- magenta, cyan, and yellow(1) Primary -- magenta, cyan, and yellow (2) Secondary -- red, green, and blue(2) Secondary -- red, green, and blue (3) See plate III(b) for illustration.(3) See plate III(b) for illustration.

Page 54: Chapter3 Image Enhancement  in the Spatial Domain

5454

4.6.14.6.1Color Fundamentals…(2)Color Fundamentals…(2)

3. 3. Characteristics of color :Characteristics of color : (1) Three basic characteristics (1) Three basic characteristics

a. brightness -- chromatic notion of intensitya. brightness -- chromatic notion of intensityb. hue -- dominant wavelength (color) perceived by b. hue -- dominant wavelength (color) perceived by

human eyeshuman eyesc. saturation -- amount of white light mixed with huec. saturation -- amount of white light mixed with hue

(2) Chromaticity -- hue + saturation(2) Chromaticity -- hue + saturation (3) trimulus values (3) trimulus values

amounts of red, green, and blue (denoted as X, Y, amounts of red, green, and blue (denoted as X, Y, and Z, respectively ) for a colorand Z, respectively ) for a color

Page 55: Chapter3 Image Enhancement  in the Spatial Domain

5555

4.6.14.6.1Color Fundamentals…(2)Color Fundamentals…(2)

(4) (4) trimulus coefficients -- x, y, z, withtrimulus coefficients -- x, y, z, withx = X / (X + Y + Z)x = X / (X + Y + Z)

y =Y / (X + Y + Z)y =Y / (X + Y + Z)

z = Z / (X + Y + Z)z = Z / (X + Y + Z)

(5) Chromaticity diagram -- Plate IV(5) Chromaticity diagram -- Plate IV

Page 56: Chapter3 Image Enhancement  in the Spatial Domain

5656

4.6.24.6.2Color models…(1)Color models…(1)

1. 1. Models :Models : (1) RGB (red, green, blue ) model(1) RGB (red, green, blue ) model

useful for hardware ; e. g., color monitors, TV cameras, etcuseful for hardware ; e. g., color monitors, TV cameras, etc (2) CMY ( cyan, magenta, yellow ) model(2) CMY ( cyan, magenta, yellow ) model

useful for color printersuseful for color printers (3) YIQ ( luminance, inphase, quatrature ) model(3) YIQ ( luminance, inphase, quatrature ) model

useful for color TV broadcastinguseful for color TV broadcasting (4) HSI (hue, saturation, intensity ) model(4) HSI (hue, saturation, intensity ) model

useful for color image manipulationuseful for color image manipulation (5) HSV (hue, saturation, value ) model(5) HSV (hue, saturation, value ) model

useful for color image manipulationuseful for color image manipulation

Page 57: Chapter3 Image Enhancement  in the Spatial Domain

5757

4.6.24.6.2Color models…(2)Color models…(2)

2. 2. Models most frequently used in image Models most frequently used in image processingprocessingRGB, YIQ, HISRGB, YIQ, HIS

3. RGB model3. RGB model (1) Good for analysis of aerial & satellite multispectral (1) Good for analysis of aerial & satellite multispectral

image data ( including 4 images of G, R and two image data ( including 4 images of G, R and two infrared ).infrared ).

(2) No good for natural scene image processing if R, G, (2) No good for natural scene image processing if R, G, & B are treated separately ( e. g., human face & B are treated separately ( e. g., human face processing ).processing ).

(3) See Fig. 4.44 for RGB color cube.(3) See Fig. 4.44 for RGB color cube.

Page 58: Chapter3 Image Enhancement  in the Spatial Domain

5858

4.6.24.6.2Color models…(3)Color models…(3)

4. 4. YIQ model :YIQ model : (1) Y represents the luminance component.(1) Y represents the luminance component. (2) Y and color information ( i.e., I + Q ) are decoupled.(2) Y and color information ( i.e., I + Q ) are decoupled. (3) Contrast enhancement of an image in the YIQ (3) Contrast enhancement of an image in the YIQ

model can be achieved by applying histogram model can be achieved by applying histogram equalization to the Y component only.equalization to the Y component only.

5. HSI model :5. HSI model : (1) I represents intensity.(1) I represents intensity. (2) advantages(2) advantages

a. I and color information ( i.e., H + S ) are decoupled ; a. I and color information ( i.e., H + S ) are decoupled ;

Page 59: Chapter3 Image Enhancement  in the Spatial Domain

5959

4.6.24.6.2Color models…(4)Color models…(4)

b. color information represented by H + S is close b. color information represented by H + S is close to the color observed by eyes.to the color observed by eyes.

(3) Good for human color inspection works.(3) Good for human color inspection works.6. Model conversions :6. Model conversions :

(1) RGB (1) RGB YIQ -- use Eq. 4.6-6 YIQ -- use Eq. 4.6-6 (2) RGB (2) RGB HSI -- use Eq. 4.6-11, 18, 21 for I, HSI -- use Eq. 4.6-11, 18, 21 for I,

H, SH, S (3) HSI (3) HSI RGB -- for detail, see pp 236-237 of RGB -- for detail, see pp 236-237 of

the textbook.the textbook.

Page 60: Chapter3 Image Enhancement  in the Spatial Domain

6060

4.6.3 4.6.3 Pseudo - color Pseudo - color image processing…(1)image processing…(1)

1. 1. PurposePurpose to assign color to monochrome images based on to assign color to monochrome images based on

properties of gray - level content of images.properties of gray - level content of images. 2. Method2. Method

(1) Intensity slicing(1) Intensity slicing (2) Gray level to color transformation(2) Gray level to color transformation (3) Filtering(3) Filtering

3. Intensity slicing3. Intensity slicing (1) slicing into two colors means the following (1) slicing into two colors means the following

transformation transformation

Page 61: Chapter3 Image Enhancement  in the Spatial Domain

6161

4.6.3 4.6.3 Pseudo - color Pseudo - color image processing…(2)image processing…(2)

L

Color

c1

c2

I1

(2) (2) General slicing means the following General slicing means the following transformationtransformation

L

Color

c1

c2

I1 I2

cM

IM

Page 62: Chapter3 Image Enhancement  in the Spatial Domain

6262

4.6.3 4.6.3 Pseudo - color Pseudo - color image processing…(3)image processing…(3)

4. 4. Gray level to color transformationGray level to color transformation (1) More general than intensity slicing.(1) More general than intensity slicing. (2) Method (2) Method

feed image gray level into three (RGB) feed image gray level into three (RGB) independent transformation functions and display independent transformation functions and display the results in a color monitor ( see Fig. 4.50 for the results in a color monitor ( see Fig. 4.50 for illustration )illustration )

(3) For example, see Fig. 4.51 and Plate VI.(3) For example, see Fig. 4.51 and Plate VI. (4) Advantages(4) Advantages

specific details in images may be emphasized.specific details in images may be emphasized.

Page 63: Chapter3 Image Enhancement  in the Spatial Domain

6363

4.6.3 4.6.3 Pseudo - color Pseudo - color image processing…(4)image processing…(4)

5. 5. A filtering approach :A filtering approach : (1) The principle is the same as that of gray (1) The principle is the same as that of gray

level to color transformation except that the level to color transformation except that the transformation are performed in the frequency transformation are performed in the frequency domain.domain.

(2) See Fig. 4.52 for illustration.(2) See Fig. 4.52 for illustration. (3) Various forms of bandreject filters are (3) Various forms of bandreject filters are

used here ( see the textbookused here ( see the textbook

Page 64: Chapter3 Image Enhancement  in the Spatial Domain

6464

4.64 4.64 Full ColorFull Color Image Processing Image Processing

1. 1. Only color image enhancement is discussed Only color image enhancement is discussed here.here.

2. When the HIS model is used, intensity is 2. When the HIS model is used, intensity is decoupled from color information. So, we can decoupled from color information. So, we can enhance the I component using any enhancement enhance the I component using any enhancement technique for monochrome images.technique for monochrome images.

3.Detail procedure when the RGB model is used :3.Detail procedure when the RGB model is used :

RGBRGB HSI HSI HIS`HIS` R`G`B`R`G`B` 4. See Plate IX for an example.4. See Plate IX for an example.