Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure...
Transcript of Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure...
![Page 1: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/1.jpg)
Image filtering
16-385 Computer VisionSpring 2020, Lecture 2http://www.cs.cmu.edu/~16385/
![Page 2: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/2.jpg)
Course announcements
• Make sure you are on Piazza (sign up on your own using the link on the course website).- I think I signed up most of you this morning.- How many of you aren’t already on Piazza?
• Make sure to take the start-of-semester survey (link posted on Piazza).- We need your responses to schedule office hours for the rest of the semester.- 40 responses (about 60%) as of this morning.
• Office hours for this week only:- Yannis (Smith Hall Rm 225), Friday, Friday 5-7 pm.- Hours decided based on survey responses so far.
![Page 3: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/3.jpg)
Overview of today’s lecture
• Types of image transformations.
• Point image processing.
• Linear shift-invariant image filtering.
• Convolution.
• Image gradients.
![Page 4: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/4.jpg)
Slide credits
Most of these slides were adapted directly from:
• Kris Kitani (15-463, Fall 2016).
Inspiration and some examples also came from:
• Fredo Durand (Digital and Computational Photography, MIT).
• Kayvon Fatahalian (15-769, Fall 2016).
![Page 5: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/5.jpg)
Types of image transformations
![Page 6: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/6.jpg)
What is an image?
![Page 7: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/7.jpg)
What is an image?
A (color) image is a 3D tensor of numbers.
![Page 8: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/8.jpg)
What is an image?red green blue
colorized for visualization
actual intensity values per channel
color image patch
How many bits are the intensity values?
Each channel is a 2D array of
numbers.
![Page 9: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/9.jpg)
What is an image?
A (grayscale) image is a 2D
function.
domainWhat is the range of the image function f?
grayscale image
![Page 10: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/10.jpg)
What types of image transformations can we do?
changes pixel values changes pixel locations
Filtering Warping
![Page 11: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/11.jpg)
What types of image transformations can we do?
changes range of image function changes domain of image function
Filtering Warping
![Page 12: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/12.jpg)
What types of image filtering can we do?
Point Operation
Neighborhood Operation
point processing
“filtering”
![Page 13: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/13.jpg)
Point processing
![Page 14: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/14.jpg)
Examples of point processingoriginal lower contrast non-linear lower contrastdarken
invert raise contrast non-linear raise contrastlighten
![Page 15: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/15.jpg)
Examples of point processingoriginal lower contrast non-linear lower contrastdarken
invert raise contrast non-linear raise contrastlighten
How would you implement these?
![Page 16: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/16.jpg)
Examples of point processingoriginal lower contrast non-linear lower contrastdarken
invert raise contrast non-linear raise contrastlighten
How would you implement these?
![Page 17: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/17.jpg)
Examples of point processingoriginal lower contrast non-linear lower contrastdarken
invert raise contrast non-linear raise contrastlighten
How would you implement these?
![Page 18: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/18.jpg)
Examples of point processingoriginal lower contrast non-linear lower contrastdarken
invert raise contrast non-linear raise contrastlighten
How would you implement these?
![Page 19: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/19.jpg)
Examples of point processingoriginal lower contrast non-linear lower contrastdarken
invert raise contrast non-linear raise contrastlighten
How would you implement these?
![Page 20: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/20.jpg)
Examples of point processingoriginal lower contrast non-linear lower contrastdarken
invert raise contrast non-linear raise contrastlighten
How would you implement these?
![Page 21: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/21.jpg)
Examples of point processingoriginal lower contrast non-linear lower contrastdarken
invert raise contrast non-linear raise contrastlighten
How would you implement these?
![Page 22: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/22.jpg)
Examples of point processingoriginal lower contrast non-linear lower contrastdarken
invert raise contrast non-linear raise contrastlighten
How would you implement these?
![Page 23: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/23.jpg)
Many other types of point processing
camera output image after stylistic tonemapping
[Bae et al., SIGGRAPH 2006]
![Page 24: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/24.jpg)
Many other types of point processing
![Page 25: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/25.jpg)
Linear shift-invariant image filtering
![Page 26: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/26.jpg)
Linear shift-invariant image filtering
• Replace each pixel by a linear combination of its neighbors (and possibly itself).
• The combination is determined by the filter’s kernel.
• The same kernel is shifted to all pixel locations so that all pixels use the same linear combination of their neighbors.
![Page 27: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/27.jpg)
Example: the box filter
• also known as the 2D rect (not rekt) filter
• also known as the square mean filter
1 1 1
1 1 1
1 1 1
• replaces pixel with local average
• has smoothing (blurring) effect
kernel
![Page 28: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/28.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1 1 1
1 1 1
1 1 1
kernel
image output
filter image (signal)output
Let’s run the box filter
note that we assume that the kernel coordinates are
centered
![Page 29: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/29.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0
1 1 1
1 1 1
1 1 1
image output
filter image (signal)output
Let’s run the box filter
kernel
![Page 30: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/30.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0
1 1 1
1 1 1
1 1 1
image output
filter image (signal)output
Let’s run the box filter
kernel
shift-invariant: as the pixel
shifts, so does the kernel
![Page 31: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/31.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10
1 1 1
1 1 1
1 1 1
image output
filter image (signal)output
Let’s run the box filter
kernel
![Page 32: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/32.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10
1 1 1
1 1 1
1 1 1
image output
filter image (signal)output
Let’s run the box filter
kernel
![Page 33: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/33.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20
1 1 1
1 1 1
1 1 1
image output
filter image (signal)output
Let’s run the box filter
kernel
![Page 34: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/34.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20
1 1 1
1 1 1
1 1 1
image output
filter image (signal)output
Let’s run the box filter
kernel
![Page 35: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/35.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20 30
1 1 1
1 1 1
1 1 1
image output
filter image (signal)output
Let’s run the box filter
kernel
![Page 36: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/36.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20 30 30
1 1 1
1 1 1
1 1 1
image output
filter image (signal)output
Let’s run the box filter
kernel
![Page 37: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/37.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20 30 30 30
1 1 1
1 1 1
1 1 1
image output
filter image (signal)output
Let’s run the box filter
kernel
![Page 38: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/38.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20 30 30 30 20
1 1 1
1 1 1
1 1 1
image output
filter image (signal)output
Let’s run the box filter
kernel
![Page 39: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/39.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20 30 30 30 20 10
1 1 1
1 1 1
1 1 1
image output
filter image (signal)output
Let’s run the box filter
kernel
![Page 40: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/40.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20 30 30 30 20 10
0
1 1 1
1 1 1
1 1 1
image output
filter image (signal)output
Let’s run the box filter
kernel
![Page 41: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/41.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20 30 30 30 20 10
0 20
1 1 1
1 1 1
1 1 1
image output
filter image (signal)output
Let’s run the box filter
kernel
![Page 42: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/42.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20 30 30 30 20 10
0 20 40
1 1 1
1 1 1
1 1 1
image output
filter image (signal)output
Let’s run the box filter
kernel
![Page 43: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/43.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20 30 30 30 20 10
0 20 40 60 60 60 40 20
01 1 1
1 1 1
1 1 1
image output
filter image (signal)output
Let’s run the box filter
kernel
![Page 44: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/44.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20 30 30 30 20 10
0 20 40 60 60 60 40 20
0 301 1 1
1 1 1
1 1 1
image output
filter image (signal)output
Let’s run the box filter
kernel
![Page 45: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/45.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20 30 30 30 20 10
0 20 40 60 60 60 40 20
0 30 50 80 80 90 60 30
0 30 50 80 80 90 60 30
0 20 30 50 50 60 40 20
0 10 20 30 30 30 20 10
10 10 10 10 0 0 0 0
10
1 1 1
1 1 1
1 1 1
image output
filter image (signal)output
Let’s run the box filter
kernel
![Page 46: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/46.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20 30 30 30 20 10
0 20 40 60 60 60 40 20
0 30 50 80 80 90 60 30
0 30 50 80 80 90 60 30
0 20 30 50 50 60 40 20
0 10 20 30 30 30 20 10
10 10 10 10 0 0 0 0
10 10 10 10 0 0 0 0
1 1 1
1 1 1
1 1 1
image output
filter image (signal)output
Let’s run the box filter
kernel
![Page 47: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/47.jpg)
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20 30 30 30 20 10
0 20 40 60 60 60 40 20
0 30 50 80 80 90 60 30
0 30 50 80 80 90 60 30
0 20 30 50 50 60 40 20
0 10 20 30 30 30 20 10
10 10 10 10 0 0 0 0
10 10 10 10 0 0 0 0
1 1 1
1 1 1
1 1 1
image output
filter image (signal)output
… and the result is
kernel
![Page 48: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/48.jpg)
Some more realistic examples
![Page 49: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/49.jpg)
Some more realistic examples
![Page 50: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/50.jpg)
Some more realistic examples
![Page 51: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/51.jpg)
Convolution
![Page 52: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/52.jpg)
Convolution for 1D continuous signals
Definition of filtering as convolution:
filtered signal input signalfilter
notice the flip
![Page 53: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/53.jpg)
Convolution for 1D continuous signals
Definition of filtering as convolution:
filtered signal input signalfilter
Consider the box filter example:
notice the flip
1D continuous box filter
filtering output is a blurred version of g
![Page 54: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/54.jpg)
Convolution for 2D discrete signals
Definition of filtering as convolution:
filtered image input imagefilter
notice the flip
![Page 55: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/55.jpg)
Convolution for 2D discrete signals
Definition of filtering as convolution:
filtered image input imagefilter
If the filter is non-zero only within , then
notice the flip
The kernel we saw earlier is the 3x3 matrix representation of .
![Page 56: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/56.jpg)
Convolution vs correlation
Definition of discrete 2D convolution: notice the flip
Definition of discrete 2D correlation: notice the lack of a flip
• Most of the time won’t matter, because our kernels will be symmetric.• Will be important when we discuss frequency-domain filtering (lectures 5-6).
![Page 57: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/57.jpg)
Separable filters
A 2D filter is separable if it can be written as the product of a “column” and a “row”.
=1
1
1
1 1 1
1 1 1
1 1 1
1 1 1
*
column
rowexample: box filter
What is the rank of this filter matrix?
![Page 58: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/58.jpg)
Separable filters
A 2D filter is separable if it can be written as the product of a “column” and a “row”.
=1
1
1
1 1 1
1 1 1
1 1 1
1 1 1
*
column
rowexample: box filter
Why is this important?
![Page 59: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/59.jpg)
Separable filters
A 2D filter is separable if it can be written as the product of a “column” and a “row”.
=1
1
1
1 1 1
1 1 1
1 1 1
1 1 1
*
column
rowexample: box filter
2D convolution with a separable filter is equivalent to two 1D convolutions (with the “column” and “row” filters).
![Page 60: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/60.jpg)
Separable filters
A 2D filter is separable if it can be written as the product of a “column” and a “row”.
=1
1
1
1 1 1
1 1 1
1 1 1
1 1 1
*
column
rowexample: box filter
2D convolution with a separable filter is equivalent to two 1D convolutions (with the “column” and “row” filters).
If the image has M x M pixels and the filter kernel has size N x N:• What is the cost of convolution with a non-separable filter?
![Page 61: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/61.jpg)
Separable filters
A 2D filter is separable if it can be written as the product of a “column” and a “row”.
=1
1
1
1 1 1
1 1 1
1 1 1
1 1 1
*
column
rowexample: box filter
2D convolution with a separable filter is equivalent to two 1D convolutions (with the “column” and “row” filters).
If the image has M x M pixels and the filter kernel has size N x N:• What is the cost of convolution with a non-separable filter? M2 x N2
• What is the cost of convolution with a separable filter?
![Page 62: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/62.jpg)
Separable filters
A 2D filter is separable if it can be written as the product of a “column” and a “row”.
=1
1
1
1 1 1
1 1 1
1 1 1
1 1 1
*
column
rowexample: box filter
2D convolution with a separable filter is equivalent to two 1D convolutions (with the “column” and “row” filters).
If the image has M x M pixels and the filter kernel has size N x N:• What is the cost of convolution with a non-separable filter? M2 x N2
• What is the cost of convolution with a separable filter? 2 x N x M2
![Page 63: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/63.jpg)
A few more filters
do you see any problems in this image?
original 3x3 box filter
![Page 64: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/64.jpg)
The Gaussian filter
• named (like many other things) after Carl Friedrich Gauss
• kernel values sampled from the 2D Gaussian function:
• weight falls off with distance from center pixel
• theoretically infinite, in practice truncated to some maximum distance
Any heuristics for selecting where to truncate?
![Page 65: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/65.jpg)
The Gaussian filter
• named (like many other things) after Carl Friedrich Gauss
• kernel values sampled from the 2D Gaussian function:
• weight falls off with distance from center pixel
• theoretically infinite, in practice truncated to some maximum distance
Any heuristics for selecting where to truncate?• usually at 2-3σ
1 2 1
2 4 2
1 2 1
116
kernel
Is this a separable filter?
![Page 66: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/66.jpg)
The Gaussian filter
• named (like many other things) after Carl Friedrich Gauss
• kernel values sampled from the 2D Gaussian function:
• weight falls off with distance from center pixel
• theoretically infinite, in practice truncated to some maximum distance
Any heuristics for selecting where to truncate?• usually at 2-3σ
1 2 1
2 4 2
1 2 1
116
kernel
Is this a separable filter? Yes!
![Page 67: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/67.jpg)
Gaussian filtering example
![Page 68: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/68.jpg)
Gaussian vs box filtering
7x7 Gaussian
7x7 box
original
Which blur do you like better?
![Page 69: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/69.jpg)
How would you create a soft shadow effect?
![Page 70: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/70.jpg)
How would you create a soft shadow effect?
Gaussian blur
overlay
![Page 71: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/71.jpg)
Other filters
0 0 0
0 1 0
0 0 0?
input filter output
![Page 72: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/72.jpg)
Other filters
0 0 0
0 1 0
0 0 0?
input filter output
unchanged
![Page 73: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/73.jpg)
Other filters
0 0 0
0 1 0
0 0 0?
input filter output
unchanged
0 0 0
0 0 1
0 0 0?
input filter output
![Page 74: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/74.jpg)
Other filters
0 0 0
0 1 0
0 0 0?
input filter output
unchanged
0 0 0
0 0 1
0 0 0?
input filter output
shift to left by one
![Page 75: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/75.jpg)
Other filters
?
input filter output
0 0 0
0 2 0
0 0 0
1 1 1
1 1 1
1 1 1
-
![Page 76: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/76.jpg)
Other filters
?
input filter output
0 0 0
0 2 0
0 0 0
1 1 1
1 1 1
1 1 1
-
• do nothing for flat areas• stress intensity peaks
sharpening
![Page 77: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/77.jpg)
Sharpening examples
![Page 78: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/78.jpg)
Sharpening examples
![Page 79: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/79.jpg)
Sharpening examples
![Page 80: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/80.jpg)
Sharpening examples
do you see any problems in this image?
![Page 81: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/81.jpg)
Do not overdo it with sharpening
original sharpened oversharpened
What is wrong in this image?
![Page 82: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/82.jpg)
Image gradients
![Page 83: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/83.jpg)
What are image edges?
Very sharp discontinuities
in intensity.
domain
grayscale image
![Page 84: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/84.jpg)
Detecting edges
How would you go about detecting edges in an image (i.e., discontinuities in a function)?
![Page 85: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/85.jpg)
Detecting edges
How would you go about detecting edges in an image (i.e., discontinuities in a function)?
✓ You take derivatives: derivatives are large at discontinuities.
How do you differentiate a discrete image (or any other discrete signal)?
![Page 86: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/86.jpg)
Detecting edges
How would you go about detecting edges in an image (i.e., discontinuities in a function)?
✓ You take derivatives: derivatives are large at discontinuities.
How do you differentiate a discrete image (or any other discrete signal)?
✓ You use finite differences.
![Page 87: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/87.jpg)
Finite differences
High-school reminder: definition of a derivative using forward difference
![Page 88: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/88.jpg)
Finite differences
High-school reminder: definition of a derivative using forward difference
Alternative: use central difference
For discrete signals: Remove limit and set h = 2
What convolution kernel does this correspond to?
![Page 89: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/89.jpg)
Finite differences
High-school reminder: definition of a derivative using forward difference
Alternative: use central difference
For discrete signals: Remove limit and set h = 2
1 0 -1
-1 0 1 ?
?
![Page 90: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/90.jpg)
Finite differences
High-school reminder: definition of a derivative using forward difference
Alternative: use central difference
For discrete signals: Remove limit and set h = 2
1 0 -1
1D derivative filter
![Page 91: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/91.jpg)
The Sobel filter
=1
2
1
1 0 -1
2 0 -2
1 0 -1
Sobel filter
1 0 -1
*
What filter is this?
1D derivative filter
![Page 92: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/92.jpg)
The Sobel filter
=1
2
1
1 0 -1
2 0 -2
1 0 -1
Sobel filter
1 0 -1
*
Blurring
1D derivative filter
In a 2D image, does this filter responses along horizontal or vertical lines?
![Page 93: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/93.jpg)
The Sobel filter
=1
2
1
1 0 -1
2 0 -2
1 0 -1
Sobel filter
1 0 -1
Blurring
1D derivative filter
Does this filter return large responses on vertical or horizontal lines?
*
![Page 94: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/94.jpg)
The Sobel filter
=1
2
1
1 0 -1
2 0 -2
1 0 -1
1 0 -1
*
Horizontal Sober filter:
What does the vertical Sobel filter look like?
![Page 95: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/95.jpg)
The Sobel filter
=1
2
1
1 0 -1
2 0 -2
1 0 -1
1 0 -1
*
Horizontal Sober filter:
Vertical Sobel filter:
=1
0
-1
1 2 1
0 0 0
-1 -2 -1
1 2 1
*
![Page 96: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/96.jpg)
Sobel filter example
original which Sobel filter? which Sobel filter?
![Page 97: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/97.jpg)
Sobel filter example
original horizontal Sobel filter vertical Sobel filter
![Page 98: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/98.jpg)
Sobel filter example
horizontal Sobel filter
vertical Sobel filter
original
![Page 99: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/99.jpg)
Several derivative filters
Scharr
3 0 -3
10 0 -10
3 0 -3
3 10 3
0 0 0
-3 -10 -3
Sobel
1 0 -1
2 0 -2
1 0 -1
1 2 1
0 0 0
-1 -2 -1
Prewitt
1 0 -1
1 0 -1
1 0 -1
1 1 1
0 0 0
-1 -1 -1
Roberts0 1
-1 0
1 0
0 -1
• How are the other filters derived and how do they relate to the Sobel filter?• How would you derive a derivative filter that is larger than 3x3?
![Page 100: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/100.jpg)
Computing image gradients1. Select your favorite derivative filters.
1 2 1
0 0 0
-1 -2 -1
1 0 -1
2 0 -2
1 0 -1
![Page 101: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/101.jpg)
Computing image gradients1. Select your favorite derivative filters.
1 2 1
0 0 0
-1 -2 -1
1 0 -1
2 0 -2
1 0 -1
2. Convolve with the image to compute derivatives.
![Page 102: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/102.jpg)
Computing image gradients1. Select your favorite derivative filters.
1 2 1
0 0 0
-1 -2 -1
1 0 -1
2 0 -2
1 0 -1
2. Convolve with the image to compute derivatives.
3. Form the image gradient, and compute its direction and amplitude.
gradient direction amplitude
![Page 103: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/103.jpg)
Image gradient example
original
gradient amplitude
vertical derivative
horizontal derivative
How does the gradient direction relate to these edges?
![Page 104: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/104.jpg)
How do you find the edge of this signal?
intensity plot
![Page 105: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/105.jpg)
How do you find the edge of this signal?
intensity plot
derivative plot
Using a derivative filter:
What’s the problem here?
![Page 106: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/106.jpg)
Differentiation is very sensitive to noise
Gaussian
derivative of blurred
input
blurred
When using derivative filters, it is critical to blur first!
How much should we blur?
![Page 107: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/107.jpg)
Derivative of Gaussian (DoG) filter
derivative of Gaussian
output (same as before)
input
• How many operations did we save?
• Any other advantages beyond efficiency?
Derivative theorem of convolution:
![Page 108: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/108.jpg)
Basically a second derivative filter.• We can use finite differences to derive it, as with first derivative filter.
Laplace filter
?
first-orderfinite difference 1 0 -1
1D derivative filter
second-orderfinite difference
Laplace filter
![Page 109: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/109.jpg)
Basically a second derivative filter.• We can use finite differences to derive it, as with first derivative filter.
Laplace filter
first-orderfinite difference 1 0 -1
1D derivative filter
second-orderfinite difference 1 -2 1
Laplace filter
![Page 110: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/110.jpg)
As with derivative, we can combine Laplace filtering with Gaussian filtering
Laplacian of Gaussian (LoG) filter
Laplacian of Gaussian
output
input
?
![Page 111: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/111.jpg)
As with derivative, we can combine Laplace filtering with Gaussian filtering
Laplacian of Gaussian (LoG) filter
Laplacian of Gaussian
output
input
“zero crossings” at edges
![Page 112: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/112.jpg)
Laplace and LoG filtering examples
Laplacian of Gaussian filtering Laplace filtering
![Page 113: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/113.jpg)
Laplacian of Gaussian vs Derivative of Gaussian
Laplacian of Gaussian filtering Derivative of Gaussian filtering
![Page 114: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/114.jpg)
Laplacian of Gaussian vs Derivative of Gaussian
Zero crossings are more accurate at localizing edges (but not very convenient).
Laplacian of Gaussian filtering Derivative of Gaussian filtering
zero-crossing peak
![Page 115: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/115.jpg)
2D Gaussian filters
Gaussian
Derivative of Gaussian
Laplacian of Gaussian
how does this relate to this lecture’s cover picture?
![Page 116: Introduction and course overvie16385/lectures/lecture2.pdf · Course announcements • Make sure you are on Piazza (sign up on your own using the link on the course website). - I](https://reader034.fdocuments.in/reader034/viewer/2022042220/5ec66be20ec61c79724ff665/html5/thumbnails/116.jpg)
Basic reading:• Szeliski textbook, Section 3.2
References