CS559: Computer Graphics

Preview:

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

CS559: Computer Graphics

Lecture 6: Painterly Rendering and EdgesLi 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

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

Another type of painterly rendering• Line Drawing

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

Another type of painterly rendering• Line Drawing

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

Edge Detection

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

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

What is an edge?

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

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]’

Less than ideal edges

Results of Sobel edge detection

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

Results of Sobel edge detection

Results of Sobel edge detection

Non-maximum Suppression

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

The Canny Edge Detector

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

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

: Gaussian filter parameter

Recommended