Docsity

Image Transformations and Spatial Filtering in Digital Image Processing - Prof. Shawn News, Lab Reports of Computer Science

Partial preview of the text

Download Image Transformations and Spatial Filtering in Digital Image Processing - Prof. Shawn News and more Lab Reports Computer Science in PDF only on Docsity!

CSE185Fall 2008Lecture 18

Image Transformations and Spatial Filtering

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

www.ImageProcessingPlace.com

Gonzalez & Woods

Today

-^

Image transformations and spatial filtering (Chap3)

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

www.ImageProcessingPlace.com

Gonzalez & Woods

Chap 3: Image transformations and spatial filtering

•^

For a mask of size

m

×

n

, we assume that

m

a +1 and

n

b +1, where

a^

and

b

are positive integers

•^

Thus our focus is on filters of odd size

-^

In general, linear spatial filtering of an image of size

M
×
N

with a

filter of size

m

×

n

is given by

where

x

and

y

are varied so that each pixel in

w

visits every pixel in

f

•^

Boundary cases (where filter extends past edge of image) are dealtwith in a number of ways: zero-padding, mirroring

(^

)^

(^

)^

(^

)

,^
,^

a^

b

s^

a t

b

g^

x y

w s t

f^

x^

s y

t

=−

=−

=^
+^

∑ ∑

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

www.ImageProcessingPlace.com

Gonzalez & Woods

Chap 3: Image transformations and spatial filtering

  • Detailed example of spatial filtering

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

www.ImageProcessingPlace.com

Gonzalez & Woods

Chap 3: Image transformations and spatial filtering

-^

Generating spatial filter masks

-^

Generating an

m

×

n

linear spatial filter requires

specifying

mn

mask coefficients

-^

These coefficients are selected based on what the filteris supposed to do

-^

Limitation for

linear

filtering is that the resulting pixel

values can only be a sum of the products of the maskcoefficients and the input image

-^

Can still design a range of filter types

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

www.ImageProcessingPlace.com

Gonzalez & Woods

Chap 3: Image transformations and spatial filtering

•^

Generating spatial filter masks

-^

Suppose we wanted to replace the pixels in an image bythe average intensity of a 3

×

3 neighborhood centered on

those pixels

-^

In vector representation this is

-^

The mask is thus

9 1 1

1 1 1 1 1 1 1 1 1[
]

i i

R

z^

z

=

=

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

www.ImageProcessingPlace.com

Gonzalez & Woods

Chap 3: Image transformations and spatial filtering

•^

Generating spatial filter masks

-^

Suppose

σ

Æ

(^

)^

(^

)^

(^

)^

(^

)

(^

)^

(^

)^

( )

( )

2

2 2

2

2 2

1

1 2

1

1

1 2

9

1,

1

1,

1

...

1,

1,

w

h^

h^

e

w

h^

h^

e

σ

σ

−^

  • − −

−

=^

−^

−^

=^

−^

−^

=

=^

=^

=

1

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

www.ImageProcessingPlace.com

Gonzalez & Woods

Chap 3: Image transformations and spatial filtering

-^

Generating

nonlinear

filters

Specify neighborhood

Specify operation

-^

Example: 5

×

5 max filter

-^

Nonlinear filters can be quite powerful and, insome applications, can perform functions thatare beyond the capabilities of linear filters

-^

(But are not implemented using the same sum-of-products framework that linear filters are)