Docsity

Digital Image Processing Lecture 2: Affine Transforms and Spatial-Domain Filtering - Prof., Study notes of Electrical and Electronics Engineering

Partial preview of the text

Download Digital Image Processing Lecture 2: Affine Transforms and Spatial-Domain Filtering - Prof. and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

ECE 468: Digital Image Processing

Lecture 2

Prof. Sinisa Todorovic

[email protected]

1

Outline

Image interpolation

MATLAB tutorial

Review of image elements

Affine transforms of images

Spatial-domain filtering

Image Interpolation

Bilinear N = 1

Bicubic N = 3

f (x, y) =

N

i=

N

j=

a

ij

x

i

y

j

3

MATLAB Image Processing Toolbox

Image Structure

7

Pixels, 4-adjacency, 8-adjacency, m-adjacency

Path -- directed, undirected, loop

Region = Connected set of pixels

Region boundary, inner and outer contour

Foreground - background

Edge = Connected pixels with high derivative values

Interest points: T-junction, Y-junction

Highlights or specularities

Lambertian surface = isotropic reflectance

Specular surface = zero reflectance except at an angle

Image Elements

9

2D Translation

displacement

[

x

y

]

=

source: S. Savarese

t =

[

t

x

t

y

]

13

2D Translation

displacement

[

x

y

]

=

source: S. Savarese

t =

[

t

x

t

y

]

P

′

= P + t =

[

x + t

x

y + t

y

]

[

1 0 t

x

0 1 t

y

]

x

y

2D Translation

displacement

homogeneous

coordinates

[

x

y

]

=

source: S. Savarese

t =

[

t

x

t

y

]

P

′

= P + t =

[

x + t

x

y + t

y

]

[

1 0 t

x

0 1 t

y

]

x

y

13

2D Translation

displacement

homogeneous

coordinates

P

′

x + t

x

y + t

y

1 0 t

x

0 1 t

y

x

y

[

x

y

]

=

source: S. Savarese

t =

[

t

x

t

y

]

P

′

= P + t =

[

x + t

x

y + t

y

]

[

1 0 t

x

0 1 t

y

]

x

y

2D Scaling

=

[

x

y

]

=

[

s

x

x

s y

y

]

s

x

x

s

y

y

s

x

0 s

y

x

y

source: S. Savarese

14

2D Scaling

=

[

x

y

]

=

[

s

x

x

s y

y

]

s

x

x

s

y

y

s

x

0 s

y

x

y

source: S. Savarese

  

scaling matrix

2D Scaling

=

[

x

y

]

=

[

s

x

x

s y

y

]

s

x

x

s

y

y

s

x

0 s

y

x

y

source: S. Savarese

  

scaling matrix

S

14

2D Scaling + Translation

P

′

= S · P

P

′′

= T · P

′

P

′′

= (T · S) · P

Is the ordering important?

source: S. Savarese

2D Rotation

counter-clockwise

by angle θ

source: S. Savarese

θ

P =

[

x

y

]

x x

′

y

′

y

P

′

[

cos θ x − sin θ y

sin θ x + cos θ y

]

x

′

y

′

cos θ − sin θ 0

sin θ cos θ 0

x

y

16

2D Rotation

counter-clockwise

by angle θ

source: S. Savarese

θ

P =

[

x

y

]

x x

′

y

′

y

P

′

[

cos θ x − sin θ y

sin θ x + cos θ y

]

x

′

y

′

cos θ − sin θ 0

sin θ cos θ 0

x

y

rotation matrix

2D Rotation

counter-clockwise

by angle θ

source: S. Savarese

θ

P =

[

x

y

]

x x

′

y

′

y

P

′

[

cos θ x − sin θ y

sin θ x + cos θ y

]

x

′

y

′

cos θ − sin θ 0

sin θ cos θ 0

x

y

rotation matrix

R

16

2D Rotation + Scaling + Translation

x

′

y

′

1

=

cos θ − sin θ 0

sin θ cos θ 0

0 0 1

1 0 t

x

0 1 t

y

0 0 1

s

x

0 0

0 s

y

0

0 0 1

x

y

1

  

scaling

matrix

S

translation

matrix

rotation

matrix

t R

x

′

y

′

[

R S t

]

x

y

Re-writing the Equation of Transformation

x

′

y

′

1

=

t

11

t

12

t

13

t

21

t

22

t

23

0 0 1

x

y

1

20

Re-writing the Equation of Transformation

x

′

y

′

1

=

t

11

t

12

t

13

t

21

t

22

t

23

0 0 1

x

y

1

x i

·t

11

  • y

i

·t

12

  • 1 ·t

13

  • 0 ·t

21

  • 0 ·t

22

  • 0 ·t

23

= x

′

i

0 ·t

11

  • 0 ·t

12

  • 0 ·t

13

  • x

i

·t

21

  • y

i

·t

22

  • 1 ·t

23

= y

′

i

Re-writing the Equation of Transformation

x

′

y

′

1

=

t

11

t

12

t

13

t

21

t

22

t

23

0 0 1

x

y

1

x i

·t

11

  • y

i

·t

12

  • 1 ·t

13

  • 0 ·t

21

  • 0 ·t

22

  • 0 ·t

23

= x

′

i

0 ·t

11

  • 0 ·t

12

  • 0 ·t

13

  • x

i

·t

21

  • y

i

·t

22

  • 1 ·t

23

= y

′

i

x

i

y

i

1 0 0 0

0 0 0 x

i

y

i

1

             

t

11

t 12

t

13

t

21

t

22

t

23

             

=

x

′

i

y

′

i

20

Summary of Affine Transforms

Addition

Multiplication

Basic Operations on Images

24

Example: Averaging Noisy Measurements

g ¯(x, y) =

K

K

i=

g

i

(x, y)

g(x, y) = f (x, y) + η(x, y)

Example: Shading Correction

g(x, y) = f (x, y)h(x, y)

26

Example: Masking

g(x, y) = f (x, y)h(x, y)