Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
Image Processing
Jung Lee
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 2 KUCG |
What is an Image?
• An image is a 2D rectilinear array of pixels
[Continuous Image] [Digital Image]
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 3 KUCG |
Quantization
• Artifact due to the limited intensity resolution
Frame buffers have limited number of bits per pixel
Physical devices have limited dynamic range
255 150 75 0
255 150 75 0
255 150 75 0
255 150 75 0
255 150 75 0
255 150 75 0
255 150 75 0
255 150 75 0
255 150 75 0
255 150 75 0
255 150 75 0
255 150 75 0
255 150 75 0
255 150 75 0
255 150 75 0
Blue Channel
Green Channel
Red Channel
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 4 KUCG |
Image Resolution
• Intensity Resolution
Each pixel has only “Depth” bits for colors/intensities
• Spatial Resolution
Image has only “Width” x “Height” pixels
• Temporal Resolution
Monitor refreshes images at only “Rate” Hz
Image Processing Operations
Brightness
Contrast
Blurring
Edge Detection
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 6 KUCG |
Brightness Control
• Simply scale pixel components
Luminance = 0.30xR + 0.59xG + 0.11xB
Must clamp to range (e.g., 0 to 255)
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 7 KUCG |
Contrast Control
• Compute mean luminance L for all pixels
• Scale deviation from L for each pixel component
Must clamp to range (e.g. 0 to 255)
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 8 KUCG |
Blurring
• A kind of image filtering techniques
Each pixel gets a weighted average of its neighbors
• By the given filter
161
162
161
162
164
162
161
162
161
Filter
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 9 KUCG |
Edge Detection
• A kind of image filtering techniques
Finds differences between neighbor pixels
111
181
111
Filter
Image Warping
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 11 KUCG |
Image Warping
• Move pixels of image
Mapping
Resampling
Warp
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 12 KUCG |
cf.) Image Morphing
• Transition effect between two images
[‘Black or White’, Michael Jackson, 1992]
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 13 KUCG |
Image Warping Overview
• Mapping
Forward
Reverse
• Resampling
Point sampling
Bilinear interpolation
Gaussian filter
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 14 KUCG |
Mapping
• Define the transformation of pixels
Describe the destination (x, y) for every location (u, v) in
the source
• Or vice-versa, if invertible
u
v
x
y
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 15 KUCG |
Mapping Example : Scaling
• Scale by factor :
x = factor * u
y = factor * v
u
v
x
y
Scale (0.8)
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 16 KUCG |
• Rotate by θ degrees:
x = u cos θ – v sin θ
y = u sin θ + v cos θ
Mapping Example : Rotation
u
v
x
y
Rotate (30)
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 17 KUCG |
Other Mapping Examples
[Fish Eye] [Swirl] [Rain]
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 18 KUCG |
• Just assign the color of (u, v) to the (x, y)
(x, y) = f(u, v)
Forward Mapping Overview
[Source Image] [Destination Image]
(x, y)
f
(u, v)
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 19 KUCG |
Artifacts of Forward Mapping
Rotate (30)
u
v
x
y
Many source pixels might be mapped to the same destination pixel
Some destination pixels might not be mapped by any source pixel
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 20 KUCG |
• Based on pixels of the destination image
Not the source image
(u, v) = f-1(x, y)
Reverse Mapping Overview
[Source Image] [Destination Image]
(x, y)
f-1
(u, v)
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 21 KUCG |
Effect of Reverse Mapping
• Many destination pixels might be still mapped to
the same source pixel
But no holes in the destination image
u
v
x
y
Rotate (30)
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 22 KUCG |
Image Warping Overview
• Mapping
Forward
Reverse
• Resampling
Point sampling
Bilinear interpolation
Gaussian filter
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 23 KUCG |
Point Sampling
• Take value of the nearest pixel from (x, y)
• Simple but causes aliasing
u
v
x
y
Rotate (30)
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 24 KUCG |
• So called stairstep effect
Aliasing from Point Sampling
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 25 KUCG |
Bilinear Interpolation
• Bilinearly interpolate four closest pixels
a = linear interpolation of src(u1, v2) and src(u2, v2)
b = linear interpolation of src(u1, v1) and src(u2, v1)
dest(x, y) = linear interpolation of ‘a’ and ‘b’
(u1, v2)
(u1, v1)
(u2, v2)
(u2, v1)
a
b
(u, v)
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 26 KUCG |
Gaussian Filtering
• Compute weighted sum of the neighbor pixels
Weights are normalized values from Gaussian filter
(u, v)
Korea University Computer Graphics Lab.
Jung Lee | September 26, 2012 | # 27 KUCG |
Comparison of Filtering Methods
• Trade-offs
Aliasing vs. blurring
Computational cost
[Point Sampling] [Bilinear Interpolation] [Gaussian Filtering]