cs559: computer graphics lecture 3: digital image representation li zhang spring 2008

Post on 28-Dec-2015

215 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

CS559: Computer Graphics

Lecture 3: Digital Image RepresentationLi Zhang

Spring 2008

Today• Eyes• Cameras

Image as a discreet function

Represented by a matrix

What is image filtering?

• Modify the pixels in an image based on some function of a local neighborhood of the pixels.

5 14

1 71

5 310

Local image data

7

Modified image data

Some function

Linear functions

• Simplest: linear filtering.– Replace each pixel by a linear combination of its

neighbors.

• The prescription for the linear combination is called the “convolution kernel”.

5 14

1 71

5 310

0.5

0.5 00

10

0 00

Local image data kernel

7

Modified image data

Convolution

lk

lkglnkmIgInmf,

],[],[],[

I

Linear filtering (warm-up slide)

original

0Pixel offset

coef

ficie

nt1.0 ?

Linear filtering (warm-up slide)

original

0Pixel offset

coef

ficie

nt1.0

Filtered(no change)

Linear filtering

0Pixel offset

coef

ficie

nt

original

1.0

?

shift

0Pixel offset

coef

ficie

nt

original

1.0

shifted

Linear filtering

0Pixel offset

coef

ficie

nt

original

0.3 ?

Blurring

0Pixel offset

coef

ficie

nt

original

0.3

Blurred (filterapplied in both dimensions).

0Pixel offset

coef

ficie

nt

0.3

original

8

filtered

2.4

impulse

Blur Examples

0Pixel offset

coef

ficie

nt

0.3

original

8

filtered

4

8

4

impulse

edge

0Pixel offset

coef

ficie

nt

0.3

original

8

filtered

2.4

Blur Examples

original

0

2.0

?0

1.0

Linear filtering (warm-up slide)

original

0

2.0

0

1.0

Filtered(no change)

Linear Filtering (no change)

original

0

2.0

0

0.33 ?

Linear Filtering

(remember blurring)

0Pixel offset

coef

ficie

nt

original

0.3

Blurred (filterapplied in both dimensions).

original

0

2.0

0

0.33

Sharpened original

Sharpening

Sharpening example

coef

ficie

nt

-0.3original

8

Sharpened(differences are

accentuated; constantareas are left untouched).

11.21.7

-0.25

8

Sharpening

before after

Spatial resolution and color

R

G

B

original

Blurring the G component

R

G

B

original processed

Blurring the R component

original processed

R

G

B

Blurring the B component

original

R

G

Bprocessed

L

a

b

A rotation of the color coordinates into directions that are more perceptually meaningful: L: luminance, a: red-green, b: blue-yellow

Lab Color Component

L

a

b

original processed

Bluring L

original

L

a

b

processed

Bluring a

original

L

a

b

processed

Bluring b

Application to image compression• (compression is about hiding differences from the

true image where you can’t see them).

Edge Detection

• Convert a 2D image into a set of curves– Extracts salient features of the scene– More compact than pixels

How can you tell that a pixel is on an edge?

Image gradient• The gradient of an image:

• The gradient direction is given by:

• The gradient points in the direction of most rapid change in intensity

– how does the gradient relate to the direction of the edge?

• The edge strength is given by the gradient magnitude

Effects of noise• Consider a single row or column of the image

– Plotting intensity as a function of position gives a signal

• Where is the edge?

How to compute a derivative?

• Where is the edge?

Solution: smooth first

• Look for peaks in

Derivative theorem of convolution

• This saves us one operation:

Laplacian of Gaussian• Consider

Laplacian of Gaussianoperator

• Where is the edge? • Zero-crossings of bottom graph

Canny Edge Detector

• Smooth image I with 2D Gaussian:

• Find local edge normal directions for each pixel

• Along this direction, compute image gradient

• Locate edges by finding max gradient magnitude (Non-maximum suppression)

x

y

I

Iarctan

IG

IG

Non-maximum Suppression

• Check if pixel is local maximum along gradient direction– requires checking interpolated pixels p and r

The Canny Edge Detector

original image (Lena)

The Canny Edge Detector

magnitude of the gradient

The Canny Edge Detector

After non-maximum suppression

Canny Edge Detector

Canny with Canny with original

• The choice of depends on desired behavior

– large detects large scale edges– small detects fine features

top related