Top Banner
Digital Image Processing, 3rd ed. Digital Image Processing, 3rd ed. www.ImageProcessingPlace.com Gonzalez & Woods Chapter 3 Intensity Transformations & Spatial Filtering Chapter 3 Intensity Transformations & Spatial Filtering Intensity transformation T maps the intensity r 0 of a pixel, P, to a new intensity value s 0 =T(r 0 ) intensity value s 0 T(r 0 ). The mapping is performed using a transfer function T T Examples of two transfer functions Examples of two transfer functions Transformation function does not take into the intensity of adjacent pixels. It does not increase the number of © 1992–2008 R. C. Gonzalez & R. E. Woods intensity values available.
65

Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Mar 08, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Intensity transformation T maps the intensity r0 of a pixel, P, to a new intensity value s0=T(r0 )intensity value s0 T(r0 ). The mapping is performed using a transfer function

TT

Examples of two transfer functionsExamples of two transfer functions• Transformation function does not take

into the intensity of adjacent pixels.• It does not increase the number of

© 1992–2008 R. C. Gonzalez & R. E. Woods

intensity values available.

Page 2: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Spatial Filter F maps the intensity Ii of a pixel, Pi, to a new intensity value based on its neighborhoodbased on its neighborhood.

TT

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 3: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Example of Intensity Transformations.• They map L intensity values

a new L intensity value s0

T

0

© 1992–2008 R. C. Gonzalez & R. E. Woods

r0

Page 4: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Intensity transformation – NegativeOriginal mammogram (left) andthe negated mammogram g g

L

s0

0 Lr0

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 5: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Intensity transformation – LogOriginal Fourier spectrum (left) andthe log transformed spectrum (right)the log transformed spectrum (right) with c = 1

)1log( rcs

s0

)g(

s0

© 1992–2008 R. C. Gonzalez & R. E. Woods

r0

Page 6: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Power-Law (Gamma) Transformations

crs Where c and γ are positive constants.

cs

It also sometime written as: )( rcs

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 7: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Gamma correction Gamma correction aims to improve the

correctness of an image when display g p yon a screen. Gamma correction controls the overall

brightness of an image. Incorrect images can look either

bleached out, or too dark.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 8: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Gamma correction

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 9: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 10: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 11: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 12: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 13: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 14: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 15: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 16: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Image HistogramThe image histogram of a digital image with intensitylevels in the range [0,L-1] is a discrete function g [ , ]h(rk) =nk , where rk is the kth intensity value and nk is the number of pixels in the image with the intensity rk

Histogram NormalizationHistogram NormalizationIt is common to normalize the histogram by dividingnk by the number of pixels in the image. The normalized intensity p(r )= n /MN estimates theThe normalized intensity p(rk)= nk /MN estimates the probability of occurrence of intensity level rk in an image

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 17: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Histogram Equalization

In general we assumeIn general we assume 1. T(r) is monotonically increasing2. 0 ≤ T(r) ≤ L-1 for 0 ≤ r ≤ L-1

Let pr(r) and ps (s) be a probability density functions. If we assume pr(r) and T(r) are know, the ( )

dsdrrpsp rs )()(

Image processing interests on the following formulation, where the right side is the cumulative distribution function

r

© 1992–2008 R. C. Gonzalez & R. E. Woods

r

r dwwpLrTs0

)()1()(

Page 18: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

)()1()()1()(

0

rpLdwwpdrdL

drrdT

drds

r

r

r

Use the previous formulation yields a uniformUse the previous formulation yields, a uniform probability density function

11)()()(

rpdrrpsp1)()1(

)()()(

LrpL

rpds

rpspr

rrs

Histogram equalization determine the transformation that seek to produce antransformation that seek to produce an output image that has a uniform histogram.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 19: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Example:

10;)1(

2)( 2

Lr

Lr

rp

112)()1()(

0)1()(

0

2

0

2

Lrwdw

LdwwpLrTs

otherwiseLrp

rr

r

r

1)1(2

)1(2)()(

11)()()(

12

2

1

2

00

Lr

drd

Lr

drds

Lr

dsdrrpsp

LLp

rs

r

11

2)1(

)1(2

2

Lr

LL

r

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 20: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Histogram Equalization In the discrete case

1,..,2,1,0;)1()()1()(00

LknMNLrpLrTs

k

jj

k

jjrkk

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 21: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Example:A 3bit image of size 64x64 [0, L-1] =[0,7]

33.1)(7)(7)(

1

0

0

000

rprprTs rj

jr

equalized histogram

08.3)(7)(7)(7)( 100

11

rprprprTs rrj

jr

00.7,86.6,65.6,23.6,67.5,55.4 765432 ssssss

We round the s values to get values of the equalized histogram

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 22: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 23: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Histogram MatchingLet us assume histograms are continuous functions, and let T(r) defined as earlier and G(z) defined similarly, then

r

r dwwpLrTs0

)()1()( z

z dttpLzGs0

)()1()(

Since T(r) = G(z) then

And

Since T(r) = G(z), then)()]([ 11 sGrTGz

This shows that that an image whose intensity levels have a specific probability density g y p p y yfunction can be obtained as follow:1. Obtain pr(r) from the input image and determine the value of s (as above)2. Use a specified PDF to obtain the transformation function G(z)3. Compute the inverse transformation z=G-1(s)4. Obtain the output image by first equalizing the input image (intensity are the s values)

for each intensity (s value) perform the inverse mapping z = G-1(s) to obtain the

© 1992–2008 R. C. Gonzalez & R. E. Woods

corresponding pixel in the output image

Page 24: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Example:

rLr

Lr

rp 2 10;)1(

2)(

rr

r

r

Lrwdw

LdwwpLrTs

otherwiseLp

0

2

0 112)()1()(

0)1()(

rz

z Lzdww

LdwwpLzG

LL

0 2

22

0 2 113)()1()(

11

Now we can compute the values of z by

3/1

2

3

)1(Lzs

Now we can compute the values of z by

3/12)1( sLz

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 25: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Example:A 3bit image of size 64x64 [0, L-1] =[0,7]

0 1 2 3 4 5 6 7

1 3 5 6 7 7 7 7

The s values from the previous example

1 3 5 6 7 7 7 7

00.0)(7)(7)( 0

0

00

rprpzG rj

jz

00.0)](7)([7)(7)( 10

1

01

zpzpzpzG rrj

jz

The G(z) values from the previous example0 1 2 3 4 5 6 7

0.0 0.0 0.0 1.05 2.45 4.55 5.95 7.00

( ) f p p

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 26: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 27: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 28: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 29: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 30: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 31: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

1 1

Spatial FilteringApplying a 3x3 filter ,w, on the image f

1

1

1

1),(),(),(

i jjyixfjiwyxg

A l i l (2 2b) fil hApplying a general (2ax2b) filter ,w, on the image f

a b

a

ai

b

bjjyixfjiwyxg ),(),(),(

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 32: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

CorrelationIs the process of moving a filter maskover the image and computing the sumg p gof products at each location.

C l tiConvolutionmoves the reversed filter mask over the image and computing the sum of products at each locationproducts at each location.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 33: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Correlation and Convolution in the 2D space.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 34: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

3x3 Spatial filters, which result in a blurring effect. The blurring depends on the ration between the central value and the “boundary” values.y

The effect of applying averaging filters of size 3,5,9, 15, and 35.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 35: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

In many application we often apply multiple filters and some of them may appear y ppcontradicting from the first glance.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 36: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

An Image as a Functionld hi k b i• We could think about an image row, as a

one dimensional function, – x is the position of the pixel – y is the color of the pixel-grayscale.

• Similarly, 2D image could be treated as 3D function.

• Actually these functions are not 3D, but 2.5 D as there is one value for each x, y value va ue

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 37: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

An Image as a Function• As we treat image as a function

It i ibl t t i

)()('lim)('0 x

xfxxfxfx

– It is possible to compute is derivative, but we need to exchange ∆x by 1.

I i ibl h fi

)()1(1

)()1()(' xIxIxIxIxI

)(')('lim)('' xfxxfxf • It is possible to compute the first

and the second derivative of an image.

1)(')1(')(''

lim)(0

xIxIxI

xxf

x

• Derivative help in determining local minima, local maxima, and change in derivative direction )()1(2)2(

)()1()1()2(1

xIxIxIxIxIxIxI

)()()(

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 38: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

First & Second Derivatives• Let us consider a vertical cut on the

fi t t ifirst two images• The function we get are below each

images

• The first derivative

S d D i ti• Second Derivative

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 39: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Gradient OperatorThe Gradient Operator for an image f at the location (x, y) is g ( , y)

Which is often approximated by:

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 40: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & WoodsGradient OperatorChapter 3

Intensity Transformations & Spatial FilteringChapter 3

Intensity Transformations & Spatial Filtering

Gradient Operator

Gradient OperatorThe direction of the Gradient vector at the location (x, y) is

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 41: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & WoodsLaplacian OperatorChapter 3

Intensity Transformations & Spatial FilteringChapter 3

Intensity Transformations & Spatial Filtering

Laplacian Operator

Laplacian OperatorThe Laplacian Operator for an image f at the location (x, y) is

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 42: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Image FilterChapter 3

Intensity Transformations & Spatial FilteringChapter 3

Intensity Transformations & Spatial Filtering

Image Filter

Image FilterImage Filters change the appearance of an image or part of an image by altering the values of its pixels.

Image Blur

Median Filter

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 43: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 44: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 45: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 46: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 47: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 48: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 49: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 50: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Set Theory

One way of defining a set A is in terms of its characteristic function . An element )(xA

x belongs to set A if and only if , where .1)( xA }1,0{:)( UxA

In such a scheme we define set operation as:

• Union as

I i

))(),(max()( xxx BABA

))()(i ()( 1)( x• Intersection as

• Complement as

S t I l i if d l if (f ll ) i li

))(),(min()( xxx BABA

)(1)( xx AA

1)( xA

1)( 1)( xBA x• Set Inclusion as if and only if (for all x) implies

• Set Equality as A = B if and only if (for all x)

1)( xA 1)( xB

)()( xx BA

BA x

x

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 51: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Fuzzy Set Theory

A fuzzy set is defined in terms of a membership function .]1,0[: UA

A characteristic function is a special case of a membership function and a regular set is a

special case of a fuzzy set.

The set operations are defined as:

• Union as

• Intersection as

))(),(max()( xxx BABA

))(),(min()( xxx BABA

• Complement as

• Set inclusion as if and only if (for all x)

S li A if if (f )

)(1)( xx AA

)()( xx BA BA x

© 1992–2008 R. C. Gonzalez & R. E. Woods

• Set Equality as A = B if and only if (for all x) )()( xx BA x

Page 52: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Illustrating The membership functions of regular and fuzzy set

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 53: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 54: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

otherwise

cazacazazbabza

zTriangle0

/)(1/)(1

)(:

dbzbcaz

bzaazcabza

zTrapezodal/)(1

1/)(1

)(:

zaazbabza

zSigma

otherwise

1/)(1

)(:

0

bzaacaz

az

otherwise

2

0

0

2

otherwise

dbzbacaz

accbazSShapeS

0

21),,;(: 2

© 1992–2008 R. C. Gonzalez & R. E. Woods

zabcbcczSczcbcbczS

zShapeBell),2/,,(1

),2/,,()(:

Page 55: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Rule-Based classification of using fuzzy sets.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 56: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 57: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 58: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 59: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 60: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Using fuzzy sets for intensitytransformation 1. Define a set of rules to change pixelg p

intensity.2. Transfer the rules into fuzzy set3. User the rules to change intensity

Example:1. If a pixel is dark, then make it darker2 If i l i th k it2. If a pixel is gray, then make it gray 3. If a pixel is bright, then make it brighter

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 61: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Using fuzzy sets for intensitytransformation 1. Define a set of rules to change pixelg p

intensity.2. Use fuzzy set to apply this rules.

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 62: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 63: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 64: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods

Page 65: Chapter 3 Intensity Transformations & Spatial …Chapter 3 Intensity Transformations & Spatial Filtering Image Histogram The image histogram of a digital image with intensity levels

Digital Image Processing, 3rd ed.Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

Gonzalez & Woods

Chapter 3Intensity Transformations & Spatial Filtering

Chapter 3Intensity Transformations & Spatial Filtering

Using fuzzy sets for spatial filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods