Professional Documents
Culture Documents
Digital Camera
255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 20 0 255 255 255 255 255 255 255
=
255 255 75 95 95 75 255 255 255 255 255 255
255 255 96 127 145 175 255 255 255 255 255 255
255 255 127 145 175 175 175 255 255 255 255 255
255 255 127 145 200 200 175 175 95 255 255 255
255 255 127 145 200 200 175 175 95 47 255 255
255 255 127 145 145 175 127 127 95 47 255 255
255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255
3D view
Example
10 5 3 0 0 0
4 6 1 0 0.5 0 8
1 1 8 0 1 0.5
Local image data kernel Modified image data
Source: L. Zhang
Filters
• Filtering
• Form a new image whose pixels are a combination of the
original pixels
• Why?
• To get useful information from images
• E.g., extract edges or contours (to understand shape)
• To enhance the image
• E.g., to remove noise
• E.g., to sharpen or to “enhance image”
Canonical Image Processing
problems
• Image Restoration
• denoising
• deblurring
• Image Compression
• JPEG, JPEG2000, MPEG..
• Computing Field Properties
• optical flow
• disparity
• Locating Structural Features
• corners
• edges
Question: Noise reduction
• Given a camera and a still scene, how can you
reduce noise?
10 5 3 Convolution
4 5 1 7
1 1 7
Source: L. Zhang
Convolution
1 1 1 0 0 0 90 90 90 90 90 0 0 0 30 60 90 90 90 60 30
1
1
1
1
1
1
*
0
0
0
0
0
0
0
0
0
90
90
90
90
0
90
90
90
90
90
90
90
90
90
90
0
0
0
0
0
0
= 0
0
0
30
30
20
50
50
30
80
80
50
80
80
50
90
90
60
60
60
40
30
30
20
0 0 0 0 0 0 0 0 0 0 10 20 30 30 30 30 20 10
0 0 90 0 0 0 0 0 0 0 10 10 10 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
Mean filtering/Moving average
Mean filtering/Moving average
Mean filtering/Moving average
Mean filtering/Moving average
Mean filtering/Moving average
Mean filtering/Moving average
Linear filters: examples
0 0 0
=
* 0
0
1
0
0
0
Source: D. Lowe
Linear filters: examples
0 0 0
=
* 1
0
0
0
0
0
Source: D. Lowe
Linear filters: examples
1 1 1
=
* 1
1
1
1
1
1
Source: D. Lowe
Linear filters: examples
-
0 0 0 1 1 1
=
* 0
0
2
0
0
0
1
1
1
1
1
1
Sharpening filter
Original (accentuates edges)
Source: D. Lowe
Sharpening
Source: D. Lowe
Smoothing with box filter revisited
Source: D. Forsyth
Gaussian Kernel
5 x 5, = 1
Source: C. Rasmussen
Gaussian Kernel
Source: C. Rasmussen
Gaussian filters
* =
Source: K. Grauman
Sharpening revisited
• What does blurring take away?
– =
original smoothed (5x5) detail
+α =
original detail sharpened
Source: S. Lazebnik
Filters: Thresholding
Image Scaling
This image is too big to fit on the
screen. How can we generate a
half-sized version?
Source: S. Seitz
Image sub-sampling
1/8
1/4
• To avoid aliasing:
• sampling rate ≥ 2 * max frequency in the image
• said another way: ≥ two samples per cycle
• This minimum sampling rate is called the Nyquist rate
Source: L. Zhang
Nyquist limit – 2D example
Good sampling
Bad sampling
Aliasing
• When downsampling by a factor of two
• Original image has frequencies that are too high
G 1/8
G 1/4
Gaussian 1/2
Source: S. Seitz
Gaussian
pre-filtering
• Solution: filter
the image, then
subsample
F0 F1 F2
F0 F1 F2
d = 1 in this
example
1 2 3 4 5
d = 1 in this
example
1 2 3 4 5
1 d = 1 in this
example
1 2 2.5 3 4 5
Nearest-neighbor
interpolation
Linear interpolation
Gaussian reconstruction
Source: B. Curless
Image interpolation
• What does the 2D version of this hat function look like?
performs
linear interpolation bilinear interpolation
-
0 0 0 1 1 1
1 1 1
0 2 0 1 1 1
1 1 1 0 0 0 1 1 1
1 1 1
https://docs.opencv.org/3.4/dc/dff/tutorial_py_pyramids.html
Question
• Suppose that you filter an image f(x,y) with a
spatial filter mask w(x,y) using convolution, where
the mask is smaller than the image in both spatial
directions.
• Show the important property that, if the coefficients of
the mask sum to zero, then the sum of all the elements
in the resulting filtered image will be zero also (you may
assume that the border of the image has been padded
with the appropriate number of zeros).
• Would the result be the same if the filtering is
implemented using correlation?
Solution