Top Banner
CSE 152 Discussion Week 3 April 15, 2019 Yu-Ying Yeh
30

CSE 152 Discussion Week 3 - Computer Science

Apr 09, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CSE 152 Discussion Week 3 - Computer Science

CSE 152 DiscussionWeek 3April 15, 2019Yu-Ying Yeh

Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Page 2: CSE 152 Discussion Week 3 - Computer Science

Homework 1: Due on Apr 24 (Wed) 23:59● Geometric Image Formation● Filtering● Template Matching● Corner Detection● Feature Matching using SIFT

Steve
Steve
Text Box
Steve
Text Box
Hw Due next Thursday
Steve
Page 3: CSE 152 Discussion Week 3 - Computer Science

Outline● Geometric Image Formation● Filtering● Template Matching● Corner Detection● Feature Matching using SIFT

Page 4: CSE 152 Discussion Week 3 - Computer Science

Recap: Filtering● 2D Convolution: Apply linear filters on image

○ Kernel is flipped over both axes

● 2D Correlation:○ Kernel is not flipped

R

I

K

Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Steve
Text Box
Kernel size = m/2 + 1
Steve
Page 5: CSE 152 Discussion Week 3 - Computer Science

Recap: Filtering● 2D Convolution: Apply linear filters on image

○ Kernel is flipped over both axes

● 2D Correlation:○ Kernel is not flipped

● Zero-padding: ○ Pad zeros outside the original image○ Question: how many pixels should we pad to maintain the same size after convolution?

R

I

K

Page 6: CSE 152 Discussion Week 3 - Computer Science

Recap: Filtering● 2D Convolution: Apply linear filters on image

○ Kernel is flipped over both axes

● 2D Correlation:○ Kernel is not flipped

● Zero-padding: ○ Pad zeros outside the original image○ Question: how many pixels should we pad to maintain the same size after convolution?○ Ans: on each side, m is kernel size

R

I

K

Steve
Page 7: CSE 152 Discussion Week 3 - Computer Science

Recap: Filtering

BOX filter

Page 8: CSE 152 Discussion Week 3 - Computer Science

Smoothing● Gaussian Smoothing

Page 9: CSE 152 Discussion Week 3 - Computer Science

Smoothing● Gaussian Smoothing ● Smoothing: BOX v.s. Gaussian

Page 10: CSE 152 Discussion Week 3 - Computer Science

Filtering

Page 11: CSE 152 Discussion Week 3 - Computer Science

Filtering

Zero Padding

Page 12: CSE 152 Discussion Week 3 - Computer Science

Filtering

Zero Padding Convolution

Gaussian Filter

Sobel Filter

Sharpening Filter

Page 13: CSE 152 Discussion Week 3 - Computer Science

Filtering

Zero Padding Convolution

Blurred

Gaussian Filter

Sobel Filter

Image Gradient

Sharpened

Sharpening Filter

Try other filters yourself …E.g., median filter, BOX filter ...

Page 14: CSE 152 Discussion Week 3 - Computer Science

Outline● Geometric Image Formation● Filtering● Template Matching● Corner Detection● Feature Matching using SIFT

Page 15: CSE 152 Discussion Week 3 - Computer Science

Template Matching● Template Image● Find the location with maximum response from the larger image

Page 16: CSE 152 Discussion Week 3 - Computer Science

Template Matching● Template Image● Find the location with maximum response from the larger image

● Find the correlation instead of convolution ○ flip back template then apply convolution

● Subtract off the mean value of the image or template to make result not biased toward higher-intensity (white) regions

Page 17: CSE 152 Discussion Week 3 - Computer Science

Outline● Geometric Image Formation● Filtering● Template Matching● Corner Detection● Feature Matching using SIFT

Page 18: CSE 152 Discussion Week 3 - Computer Science

Corner Detection1. Filter image with a Gaussian

a. Convolution with Gaussian filter

2. Compute the gradient everywherea. Convolution with [1 0 -1] and [1 0 -1].T to get and

3. Compute C(x,y) over the window at every pointa. Sum the , and over the window by convolution with a window of ones

4. Find and at each location by calculating eigenvalues of C5. Detect corner if both and are large

a. r(x,y) = min ( , )b. Non-Maximum Suppression

i. Detect corner if r(x,y) is local maximum within a windowii. Set response map of other non-maximum pixels to zeros

Page 19: CSE 152 Discussion Week 3 - Computer Science

Corner Detection1. Filter image with a Gaussian

a. Convolution with Gaussian filter (from previous question)

2. Compute the gradient everywherea. Convolution with [1 0 -1] and [1 0 -1].T to get and

Noisy step edge

Page 20: CSE 152 Discussion Week 3 - Computer Science

Corner Detection3. Compute C(x,y) over the window at every point

a. Sum the , and over the window by convolution with a window of ones

Page 21: CSE 152 Discussion Week 3 - Computer Science

Corner Detection3. Compute C(x,y) over the window at every point

a. Sum the , and over the window by convolution with a window of ones

ElementwiseMultiplication

Page 22: CSE 152 Discussion Week 3 - Computer Science

Corner Detection3. Compute C(x,y) over the window at every point

a. Sum the , and over the window by convolution with a window of ones

Sum filter

ConvElementwiseMultiplication

Page 23: CSE 152 Discussion Week 3 - Computer Science

Corner Detection4. Find and at each location by calculating eigenvalues of C

Page 24: CSE 152 Discussion Week 3 - Computer Science

Corner Detection4. Find and at each location by calculating eigenvalues of C

Solve

Is equivalent to solve

When the linear system has non-trivial solutions,

Page 25: CSE 152 Discussion Week 3 - Computer Science

Corner Detection4. Find and at each location by calculating eigenvalues of C

Solve

Is equivalent to solve

When the linear system has non-trivial solutions,

Not necessarily need for loop until now

Page 26: CSE 152 Discussion Week 3 - Computer Science

Corner Detection5. Detect corner if both and are large

a. r(x,y) = min ( , )b. Non-Maximum Suppression (NMS)

i. Detect corner if r(x,y) is local maximum within a windowii. Set response map of other non-maximum pixels to zeros

Page 27: CSE 152 Discussion Week 3 - Computer Science

Corner Detection● Sample results

Page 28: CSE 152 Discussion Week 3 - Computer Science

Outline● Geometric Image Formation● Filtering● Template Matching● Corner Detection● Feature Matching using SIFT

Page 29: CSE 152 Discussion Week 3 - Computer Science

Feature Matching using SIFT● SIFT feature extractor -> 128-d descriptor● Distance: SSD (Sum of Squares Differences)● Accept matching if best match’s distance is small enough (SSD threshold)

and (Nearest Neighbor threshold)

Steve
Page 30: CSE 152 Discussion Week 3 - Computer Science

Q & A