430 likes | 441 Views
CS559: Computer Graphics. Lecture 3: Digital Image Representation Li Zhang Spring 2008. Today. Eyes Cameras. Represented by a matrix. Image as a discreet function. 10. 5. 3. 4. 5. 7. 1. 1. 1. 7. Some function. Local image data. Modified image data. What is image filtering?.
E N D
CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008
Today • Eyes • Cameras
Represented by a matrix Image as a discreet function
10 5 3 4 5 7 1 1 1 7 Some function Local image data Modified image data What is image filtering? • Modify the pixels in an image based on some function of a local neighborhood of the pixels.
0 0 0 0 0.5 0 0 1 0.5 10 5 3 4 7 5 1 1 1 7 Local image data kernel Modified image data 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”.
I Convolution
coefficient 0 Pixel offset Linear filtering (warm-up slide) ? 1.0 original
coefficient 0 Pixel offset Linear filtering (warm-up slide) 1.0 original Filtered (no change)
coefficient 0 Pixel offset Linear filtering 1.0 ? original
coefficient 0 Pixel offset shift 1.0 original shifted
coefficient 0 Pixel offset Linear filtering ? 0.3 original
coefficient 0 Pixel offset Blurring 0.3 original Blurred (filter applied in both dimensions).
8 coefficient 0 original Pixel offset Blur Examples 2.4 impulse 0.3 filtered
8 coefficient coefficient 0 0 original Pixel offset Pixel offset Blur Examples 2.4 impulse 0.3 filtered 8 8 edge 4 4 0.3 filtered original
Linear filtering (warm-up slide) 2.0 1.0 ? 0 0 original
Linear Filtering (no change) 2.0 1.0 0 0 Filtered (no change) original
0.33 0 Linear Filtering 2.0 ? 0 original
coefficient 0 Pixel offset (remember blurring) 0.3 original Blurred (filter applied in both dimensions).
0.33 0 Sharpening 2.0 0 Sharpened original original
Sharpening example 1.7 11.2 8 8 coefficient -0.25 -0.3 original Sharpened (differences are accentuated; constant areas are left untouched).
Sharpening before after
Spatial resolution and color R G B original
R G B Blurring the G component processed original
R G B Blurring the R component processed original
R G B processed Blurring the B component original
Lab Color Component L A rotation of the color coordinates into directions that are more perceptually meaningful: L: luminance, a: red-green, b: blue-yellow a b
L a b processed Bluring L original
L a b processed Bluring a original
L a b processed Bluring b original
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
Image gradient • The gradient of an image: • The gradient points in the direction of most rapid change in intensity • The gradient direction is given by: • 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 How to compute a derivative? • Where is the edge?
Look for peaks in Solution: smooth first • Where is the edge?
Derivative theorem of convolution • This saves us one operation:
Laplacian of Gaussian • Consider Laplacian of Gaussian operator • 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)
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 original Canny with Canny with • The choice of depends on desired behavior • large detects large scale edges • small detects fine features