CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.
-
Upload
alisha-stafford -
Category
Documents
-
view
215 -
download
0
Transcript of CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.
![Page 1: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/1.jpg)
CS559: Computer Graphics
Lecture 3: Digital Image RepresentationLi Zhang
Spring 2008
![Page 2: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/2.jpg)
Today• Eyes• Cameras
![Page 3: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/3.jpg)
Image as a discreet function
Represented by a matrix
![Page 4: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/4.jpg)
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
![Page 5: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/5.jpg)
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
![Page 6: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/6.jpg)
Convolution
lk
lkglnkmIgInmf,
],[],[],[
I
![Page 7: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/7.jpg)
Linear filtering (warm-up slide)
original
0Pixel offset
coef
ficie
nt1.0 ?
![Page 8: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/8.jpg)
Linear filtering (warm-up slide)
original
0Pixel offset
coef
ficie
nt1.0
Filtered(no change)
![Page 9: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/9.jpg)
Linear filtering
0Pixel offset
coef
ficie
nt
original
1.0
?
![Page 10: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/10.jpg)
shift
0Pixel offset
coef
ficie
nt
original
1.0
shifted
![Page 11: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/11.jpg)
Linear filtering
0Pixel offset
coef
ficie
nt
original
0.3 ?
![Page 12: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/12.jpg)
Blurring
0Pixel offset
coef
ficie
nt
original
0.3
Blurred (filterapplied in both dimensions).
![Page 13: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/13.jpg)
0Pixel offset
coef
ficie
nt
0.3
original
8
filtered
2.4
impulse
Blur Examples
![Page 14: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/14.jpg)
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
![Page 15: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/15.jpg)
original
0
2.0
?0
1.0
Linear filtering (warm-up slide)
![Page 16: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/16.jpg)
original
0
2.0
0
1.0
Filtered(no change)
Linear Filtering (no change)
![Page 17: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/17.jpg)
original
0
2.0
0
0.33 ?
Linear Filtering
![Page 18: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/18.jpg)
(remember blurring)
0Pixel offset
coef
ficie
nt
original
0.3
Blurred (filterapplied in both dimensions).
![Page 19: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/19.jpg)
original
0
2.0
0
0.33
Sharpened original
Sharpening
![Page 20: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/20.jpg)
Sharpening example
coef
ficie
nt
-0.3original
8
Sharpened(differences are
accentuated; constantareas are left untouched).
11.21.7
-0.25
8
![Page 21: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/21.jpg)
Sharpening
before after
![Page 22: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/22.jpg)
Spatial resolution and color
R
G
B
original
![Page 23: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/23.jpg)
Blurring the G component
R
G
B
original processed
![Page 24: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/24.jpg)
Blurring the R component
original processed
R
G
B
![Page 25: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/25.jpg)
Blurring the B component
original
R
G
Bprocessed
![Page 26: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/26.jpg)
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
![Page 27: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/27.jpg)
L
a
b
original processed
Bluring L
![Page 28: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/28.jpg)
original
L
a
b
processed
Bluring a
![Page 29: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/29.jpg)
original
L
a
b
processed
Bluring b
![Page 30: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/30.jpg)
Application to image compression• (compression is about hiding differences from the
true image where you can’t see them).
![Page 31: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/31.jpg)
Edge Detection
• Convert a 2D image into a set of curves– Extracts salient features of the scene– More compact than pixels
![Page 32: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/32.jpg)
How can you tell that a pixel is on an edge?
![Page 33: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/33.jpg)
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
![Page 34: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/34.jpg)
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?
![Page 35: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/35.jpg)
• Where is the edge?
Solution: smooth first
• Look for peaks in
![Page 36: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/36.jpg)
Derivative theorem of convolution
• This saves us one operation:
![Page 37: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/37.jpg)
Laplacian of Gaussian• Consider
Laplacian of Gaussianoperator
• Where is the edge? • Zero-crossings of bottom graph
![Page 38: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/38.jpg)
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
![Page 39: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/39.jpg)
Non-maximum Suppression
• Check if pixel is local maximum along gradient direction– requires checking interpolated pixels p and r
![Page 40: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/40.jpg)
The Canny Edge Detector
original image (Lena)
![Page 41: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/41.jpg)
The Canny Edge Detector
magnitude of the gradient
![Page 42: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/42.jpg)
The Canny Edge Detector
After non-maximum suppression
![Page 43: CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.](https://reader030.fdocuments.us/reader030/viewer/2022032707/56649e4c5503460f94b41cd9/html5/thumbnails/43.jpg)
Canny Edge Detector
Canny with Canny with original
• The choice of depends on desired behavior
– large detects large scale edges– small detects fine features