65
Digital Image Processing, 3rd ed. www.ImageProcessingPlace.com © 19922008 R. C. Gonzalez & R. E. Woods Gonzalez & Woods 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 ). The mapping is performed using a transfer function Examples of two transfer functions T Transformation function does not take into the intensity of adjacent pixels. It does not increase the number of intensity values available.

Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Intensity transformation T maps the

intensity r0 of a pixel, P, to a new

intensity value s0=T(r0 ).

The mapping is performed using a

transfer function

Examples of two transfer functions

T

• Transformation function does not take

into the intensity of adjacent pixels.

• It does not increase the number of

intensity values available.

Page 2: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Spatial Filter F maps the intensity Ii of

a pixel, Pi, to a new intensity value

based on its neighborhood.

T

Page 3: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Example of Intensity Transformations.

• They map L intensity values

a new L intensity value

T

r0

s0

Page 4: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Intensity transformation – Negative

Original mammogram (left) and

the negated mammogram

0 L

L

r0

s0

Page 5: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Intensity transformation – Log

Original Fourier spectrum (left) and

the log transformed spectrum (right)

with c = 1

r0

s0

)1log( rcs

Page 6: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Power-Law (Gamma) Transformations

Where c and γ are positive constants.

It also sometime written as:

crs

)( rcs

Page 7: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Gamma correction

Gamma correction aims to improve the

correctness of an image when display

on a screen.

Gamma correction controls the overall

brightness of an image.

Incorrect images can look either

bleached out, or too dark.

Page 8: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Gamma correction

Page 9: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 10: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 11: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 12: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 13: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 14: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 15: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 16: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Image Histogram

The image histogram of a digital image with intensity

levels in the range [0,L-1] is a discrete function 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 Normalization

It is common to normalize the histogram by dividing nk by

the number of pixels in the image. The normalized

intensity p(rk)= nk /MN estimates the probability of

occurrence of intensity level rk in an image

int[] histogram(Mat img){

int hist[256] ;

memset(hist, 0, 256);

for ( int row = 0 ; row < img.rows; row++)

for ( int col = 0 ; col < img.cols; col++ )

hist[img.at<uchar>(row, col)]++ ;

return hist ;

}

Page 17: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Histogram Equalization

In general we assume

1. T(r) is monotonically increasing

2. 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

ds

drrpsp rs )()(

Image processing interests on the following

formulation, where the right side is the

cumulative distribution function

r

r dwwpLrTs0

)()1()(

Page 18: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

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

0

rpLdwwpdr

dL

dr

rdT

dr

dsr

r

r

Use the previous formulation yields, a uniform

probability density function

1

1

)()1(

1)()()(

LrpLrp

ds

drrpsp

r

rrs

Histogram equalization determine the

transformation that seek to produce an

output image that has a uniform histogram.

Page 19: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Example:

1

1

2

)1(

)1(

2

1)1(

2

)1(

2)()(

11

2)()1()(

0

10;)1(

2

)(

2

12

2

1

2

0

2

0

2

Lr

L

L

r

L

r

dr

d

L

r

dr

ds

L

r

ds

drrpsp

L

rwdw

LdwwpLrTs

otherwise

LrL

r

rp

rs

rr

r

r

Page 20: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Histogram Equalization

In the discrete case

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

)()1()(00

LknMN

LrpLrTs

k

j

j

k

j

jrkk

Page 21: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Example:

A 3bit image of size 64x64

[0, L-1] =[0,7]

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

33.1)(7)(7)(

10

1

0

11

0

0

0

00

rprprprTs

rprprTs

rr

j

jr

r

j

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

equalized histogram

Page 22: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 23: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Histogram Matching

Let 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

)()]([ 11 sGrTGz

This shows that that an image whose intensity levels have a specific probability density

function 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

corresponding pixel in the output image

And

Page 24: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Example:

rz

z

rr

r

r

L

zdww

LdwwpLzG

L

rwdw

LdwwpLrTs

otherwise

LrL

r

rp

0 2

22

0 2

0

2

0

2

11

3)()1()(

11

2)()1()(

0

10;)1(

2

)(

3/12

2

3

)1(

)1(

sLz

L

zs

Now we can compute the values of z by

Page 25: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity 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

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

00.0)(7)(7)(

10

1

0

1

0

0

0

0

zpzpzpzG

rprpzG

rr

j

jz

r

j

jz

0 1 2 3 4 5 6 7

0.0 0.0 0.0 1.05 2.45 4.55 5.95 7.00

The G(z) values from the previous example

Page 26: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 27: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 28: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 29: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Local Histogram

Local histogram represents the distribution

of intensity over a window (sub-image).

Local Histogram Equalization is performed

according to this window.

Page 30: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Image Moment

The nth moment of an image is defines as

The intensity variance is defines as

Page 31: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

1

1

1

1

),(),(),(i j

jyixfjiwyxg

Spatial Filtering

Applying a 3x3 filter ,w, on the image f

Applying a general (2ax2b) filter ,w, on the

image f

a

ai

b

bj

jyixfjiwyxg ),(),(),(

Page 32: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Correlation

Is the process of moving a filter mask

over the image and computing the sum

of products at each location.

Convolution

moves the reversed filter mask over

the image and computing the sum of

products at each location.

Page 33: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Correlation and Convolution in the

2D space.

Page 34: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity 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.

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

and 35.

Page 35: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Smoothing filters – Gaussian Based

Page 36: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

In many application we often

apply multiple filters and

some of them may appear

contradicting from the first

glance.

Page 37: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

An Image as a Function

• 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

Page 38: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

An Image as a Function

• As we treat image as a function

– It is possible to compute is

derivative, but we need to

exchange ∆x by 1.

• It is possible to compute the first

and the second derivative of an

image.

• Derivative help in determining local

minima, local maxima, and change

in derivative direction

)()1(1

)()1()('

)()('lim)('

0

xIxIxIxI

xI

x

xfxxfxf

x

)()1(2)2(

)()1()1()2(

1

)(')1(')(''

)(')('lim)(''

0

xIxIxI

xIxIxIxI

xIxIxI

x

xfxxfxf

x

Page 39: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

First & Second Derivatives

• Let us consider a vertical cut on the

first two images

• The function we get are below each

images

• The first derivative

• Second Derivative

Page 40: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Gradient Operator

The Gradient Operator for an

image f at the location (x, y) is

Which is often approximated by:

Page 41: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Laplacian Operator

The Laplace operator is a second order differential operator in the n-dimensional

Euclidean space, defined as the divergence (∇·) of the gradient (∇ƒ).

If ƒ is a twice-differentiable real-valued function, then the Laplacian of ƒ is defined by

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

defined similarly

Page 42: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Image Filter

Image Filters change the appearance of an image or part of an image by altering the values

of its pixels.

Image Blur

Median Filter

Page 43: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 44: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 45: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 46: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 47: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 48: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 49: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 50: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Set Theory

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

x belongs to set A if and only if , where .

In such a scheme we define set operation as:

• Union as

• Intersection as

• Complement as

• 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,0{:)( UxA

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

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

)(1)( xx AA

)(xA

1)( xA

1)( xA 1)( xB

)()( xx BA

BA x

x

Page 51: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Fuzzy Set Theory

A fuzzy set is defined in terms of a membership function .

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

• Complement as

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

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

]1,0[: UA

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

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

)(1)( xx AA

)()( xx BA

)()( xx BA

BA x

x

Page 52: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Illustrating The membership functions of regular and fuzzy set

Page 53: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 54: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

zabcbcczS

czcbcbczSzShapeBell

otherwise

dbzbac

az

bzaac

az

az

cbazSShapeS

otherwise

za

azbabza

zSigma

otherwise

dbzbcaz

bza

azcabza

zTrapezodal

otherwise

cazacaz

azbabza

zTriangle

),2/,,(1

),2/,,()(:

0

21

2

0

),,;(:

0

1

/)(1

)(:

0

/)(1

1

/)(1

)(:

0

/)(1

/)(1

)(:

2

2

Page 55: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Rule-Based classification of using

fuzzy sets.

Page 56: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 57: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 58: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 59: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 60: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Using fuzzy sets for intensity

transformation

1. Define a set of rules to change pixel

intensity.

2. Transfer the rules into fuzzy set

3. User the rules to change intensity

Example:

1. If a pixel is dark, then make it darker

2. If a pixel is gray, then make it gray

3. If a pixel is bright, then make it brighter

Page 61: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Using fuzzy sets for intensity

transformation

1. Define a set of rules to change pixel

intensity.

2. Use fuzzy set to apply this rules.

Page 62: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 63: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 64: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Page 65: Digital Image Processing, 3rd ed.dip201/wiki.files/DIP3E_Chapter03_Art.pdf · Example: A 3bit image of size 64x64 [0, L-1] =[0,7] ... Digital Image Processing, 3rd ed. ... Is the

Digital Image Processing, 3rd ed.

www.ImageProcessingPlace.com

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

Gonzalez & Woods

Chapter 3 Intensity Transformations & Spatial Filtering

Using fuzzy sets for spatial filtering