Download presentation
Presentation is loading. Please wait.
Published byMyrtle Hopkins Modified over 9 years ago
1
Lecture 2: Filtering CS4670/5670: Computer Vision Kavita Bala
2
Announcements PA 1 will be out early next week (Monday) – due in 2 weeks – to be done in groups of two – please form your groups ASAP We will grade in demo sessions
3
Linear filtering One simple version: linear filtering – Replace each pixel by a linear combination (a weighted sum) of its neighbors – Simple, but powerful – Cross-correlation, convolution The prescription for the linear combination is called the “kernel” (or “mask”, “filter”) 0.5 00 10 000 kernel 8 Modified image data Source: L. Zhang Local image data 614 181 5310
4
Filter Properties Linearity – Weighted sum of original pixel values – Use same set of weights at each point – S[f + g] = S[f] + S[g] – S[p f + q g] = p S[f] + q S[g] Shift-invariance – If f[m,n] g[m,n], then f[m-p,n-q] g[m-p, n-q] – The operator behaves the same everywhere SS
5
Cross-correlation This is called a cross-correlation operation: Let be the image, be the kernel (of size 2k+1 x 2k+1), and be the output image Can think of as a “dot product” between local neighborhood and kernel for each pixel
6
Convolution Same as cross-correlation, except that the kernel is “flipped” (horizontally and vertically) Convolution is commutative and associative This is called a convolution operation:
7
Convolution Adapted from F. Durand
8
Pseudo-code CS 4620 and 5625 cover topic in detail
9
Linear filters: examples 000 001 000 Original Shifted left By 1 pixel Source: D. Lowe * =
10
Convolution Point spread function, impulse response function PSF of Hubble Telescope
11
http://aetherforce.com/wp-content/uploads/2013/10/8707342.jpg
12
Smoothing with box filter Source: D. Forsyth 111 111 111
13
Gaussian Kernel Source: C. Rasmussen
14
Gaussian Kernel 0.003 0.013 0.022 0.013 0.003 0.013 0.059 0.097 0.059 0.013 0.022 0.097 0.159 0.097 0.022 0.013 0.059 0.097 0.059 0.013 0.003 0.013 0.022 0.013 0.003 5 x 5, = 1 Source: C. Rasmussen
15
Gaussian filters = 30 pixels= 1 pixel = 5 pixels = 10 pixels
16
Mean vs. Gaussian filtering
17
Detour: Fourier Analysis Every signal has some frequency Fourier analysis finds frequencies of a signal – Sum of sine/cosine waves Source: Foley, van Dam
18
Detour: Fourier Analysis Source: Foley, van Dam
20
Convolution is special Convolution in image space – Multiplication in Fourier space Box filter -> sinc in Fourier space Gaussian filter -> Gaussian in Fourier space
21
Low pass filtering Source: Foley, van Dam
22
Gaussian filter Removes “high-frequency” components from the image (low-pass filter) Convolution with self is another Gaussian – Convolving twice with Gaussian kernel of width = convolving once with kernel of width Source: K. Grauman * =
23
Source: Foley, van Dam
24
Sharpening What does blurring take away? original smoothed (5x5) – detail = sharpened = Let’s add it back: originaldetail + α Source: S. Lazebnik
25
Linear filters: examples Original 111 111 111 000 020 000 - Sharpening filter (accentuates edges) Source: D. Lowe = *
26
Sharpening Source: D. Lowe
27
Sharpen filter Gaussian scaled impulse Laplacian of Gaussian image blurred image unit impulse (identity)
28
Sharpen filter unfiltered filtered
29
“Optical” Convolution Source: http://lullaby.homepage.dk/diy-camera/bokeh.html Bokeh: Blur in out-of-focus regions of an image. Camera shake * = Source: Fergus, et al. “Removing Camera Shake from a Single Photograph”, SIGGRAPH 2006
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.