21
CS559: Computer Graphics Lecture 6: Painterly Rendering and Edges Li Zhang Spring 2010

CS559: Computer Graphics

Embed Size (px)

DESCRIPTION

CS559: Computer Graphics. Lecture 6: Painterly Rendering and Edges Li Zhang Spring 2010. Another type of painterly rendering. Line Drawing. http://www.cs.rutgers.edu/~decarlo/abstract.html. Another type of painterly rendering. Line Drawing. - PowerPoint PPT Presentation

Citation preview

Page 1: CS559: Computer Graphics

CS559: Computer Graphics

Lecture 6: Painterly Rendering and EdgesLi Zhang

Spring 2010

Page 2: CS559: Computer Graphics

Another type of painterly rendering• Line Drawing

http://www.cs.rutgers.edu/~decarlo/abstract.html

Page 3: CS559: Computer Graphics

Another type of painterly rendering• Line Drawing

http://www.cs.rutgers.edu/~decarlo/abstract.html

Page 4: CS559: Computer Graphics

Another type of painterly rendering• Line Drawing

http://www.cs.rutgers.edu/~decarlo/abstract.html

Page 5: CS559: Computer Graphics

Another type of painterly rendering• Line Drawing

http://www.cs.rutgers.edu/~decarlo/abstract.html

Page 6: CS559: Computer Graphics

Edge Detection

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

Page 7: CS559: Computer Graphics

Edge detection• One of the most important uses of image

processing is edge detection:– Really easy for humans– Not that easy for computers

– Fundamental in computer vision– Important in many graphics applications

Page 8: CS559: Computer Graphics

What is an edge?

• Q: How might you detect an edge in 1D?

Page 9: CS559: Computer Graphics

Gradients• The gradient is the 2D equivalent of the

derivative:

• Properties of the gradient– It’s a vector– Points in the direction of maximum increase of f– Magnitude is rate of increase

• How can we approximate the gradient in a discrete image?

( , ) ,f f

f x yx y

gx[i,j] = f[i+1,j] – f[i,j] and gy[i,j]=f[i,j+1]-f[i,j]Can write as mask [-1 1] and [1 –1]’

Page 10: CS559: Computer Graphics

Less than ideal edges

Page 11: CS559: Computer Graphics

Results of Sobel edge detection

Page 12: CS559: Computer Graphics

Edge enhancement• A popular gradient magnitude computation is

the Sobel operator:

• We can then compute the magnitude of the vector (sx, sy).

1 0 1

2 0 2

1 0 1

1 2 1

0 0 0

1 2 1

x

y

s

s

Page 13: CS559: Computer Graphics

Results of Sobel edge detection

Page 14: CS559: Computer Graphics

Results of Sobel edge detection

Page 15: CS559: Computer Graphics

Non-maximum Suppression

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

The Canny Edge Detector

Page 16: CS559: Computer Graphics

Steps in edge detection• Edge detection algorithms typically proceed in

three or four steps:– Filtering: cut down on noise– Enhancement: amplify the difference between

edges and non-edges– Detection: use a threshold operation– Localization (optional): estimate geometry of

edges, which generally pass between pixels

Page 17: CS559: Computer Graphics

The Canny Edge Detector

original image (Lena)

Page 18: CS559: Computer Graphics

The Canny Edge Detector

magnitude of the gradient

Page 19: CS559: Computer Graphics

The Canny Edge Detector

After non-maximum suppression

Page 20: CS559: Computer Graphics

Canny Edge Detector

Canny with Canny with original

• The choice of depends on desired behavior

– large detects large scale edges– small detects fine features

: Gaussian filter parameter

Page 21: CS559: Computer Graphics