computer vision i - filtering and feature detection · •linear filtering •non-linear filtering...

65
Computer Vision I - Filtering and Feature detection Carsten Rother Computer Vision I: Basics of Image Processing 30/10/2015

Upload: others

Post on 18-Oct-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Computer Vision I -Filtering and Feature detection

Carsten Rother

Computer Vision I: Basics of Image Processing

30/10/2015

Page 2: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Roadmap: Basics of Digital Image Processing

• What is an Image?

• Point operators (ch. 3.1)

• Filtering: (ch. 3.2, ch 3.3, ch. 3.4)

• Linear filtering

• Non-linear filtering

• Edges detection (ch. 4.2)

• Interest Point detection (ch. 4.1.1)

30/10/2015 2Computer Vision I: Basics of Image Processing

Page 3: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Reminder: Convolution

• Replace each pixel by a linear combination of its neighbours and itself

• 2D convolution (discrete)

𝑔 = 𝑓 ∗ ℎ

30/10/2015 3

𝑔 𝑥, 𝑦 = 𝑘,𝑙 𝑓 𝑥 − 𝑘, 𝑦 − 𝑙 ℎ 𝑘, 𝑙

𝑓 𝑥, 𝑦 ℎ 𝑥, 𝑦 g 𝑥, 𝑦

Centred at 0,0

“the image f is implicitly mirrored”

Computer Vision I: Basics of Image Processing

Page 4: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Reminder: Application: Noise removal

• Noise is what we are not interested in:Sensor noise (Gaussian, shot noise), quantisation artefacts, light fluctuation, etc.

• Typical assumption is that the noise is not correlated between pixels

• Basic Idea: neighbouring pixel contain information about intensity

30/10/2015 4Computer Vision I: Basics of Image Processing

Page 5: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Reminder: Gaussian (Smoothing) Filters

• Nearby pixels are weighted more than distant pixels

• Isotropic Gaussian (rotational symmetric)

30/10/2015 5Computer Vision I: Basics of Image Processing

Page 6: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

The box filter does noise removal

• Box filter takes the mean in a neighbourhood

30/10/2015Computer Vision I: Basics of Image Processing 6

Filtered Image

Image Pixel-independent Gaussian noise added

Noise

Page 7: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Derivation of the Box Filter

• 𝑦𝑟 is true gray value (color)

• 𝑥𝑟 observed gray value (color)

• Noise model: Gaussian noise

𝑝 𝑥𝑟 𝑦𝑟) = 𝑁 𝑥𝑟; 𝑦𝑟 , 𝜎 ~ exp[−𝑥𝑟−𝑦𝑟

2

2𝜎2]

30/10/2015Computer Vision I: Basics of Image Processing 7

𝑦𝑟 𝑥𝑟

Page 8: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Derivation of Box Filter

30/10/2015Computer Vision I: Basics of Image Processing 8

Further assumption: independent noise

Find the most likely solution for the true signal 𝑦Maximum-Likelihood principle (probability maximization):

𝑝(𝑥) is a constant (drop it), assume (for now) uniform prior 𝑝(𝑦). We get:

𝑝 𝑥 𝑦) ~ exp[−𝑥𝑟−𝑦𝑟

2

2𝜎2]

𝑟

𝑦∗ = 𝑎𝑟𝑔𝑚𝑎𝑥𝑦 𝑝 𝑦 𝑥) = 𝑎𝑟𝑔𝑚𝑎𝑥𝑦𝑝 𝑥 𝑦 𝑝 𝑦

𝑝(𝑥)

the solution is trivial: 𝑦𝑟 = 𝑥𝑟 for all 𝑟

additional assumptions about the signal 𝒚 are necessary !!!

𝑝 𝑦 𝑥) = 𝑝 𝑥 𝑦 ∼ exp[−𝑥𝑟 − 𝑦𝑟

2

2𝜎2]

𝑟

posteriorlikelihood prior

Comments:1) ~means equal up to scale

(i.e. 5𝑥 ~ 𝑥)

2) 𝑎 2 = 𝑎22= 𝑎2

(i.e. squared L2 norm)3) |𝑎| is norm of a

(i.e. L1 norm)

Page 9: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Derivation of Box Filter

30/10/2015Computer Vision I: Basics of Image Processing 9

Assumption: not uniform prior 𝑝 𝑦 but …in a small vicinity the “true” signal is nearly constant

Maximum-a-posteriori:

𝑝 𝑦 𝑥) ∼ exp[−‖𝑥𝑟′ − 𝑦𝑟 ‖

2

2𝜎2]

𝑦𝑟∗ = 𝑎𝑟𝑔𝑚𝑎𝑥𝑦𝑟 exp[−

𝑥𝑟′ − 𝑦𝑟2

2𝜎2]

𝑦𝑟∗ = 𝑎𝑟𝑔𝑚𝑖𝑛𝑦𝑟

𝑥𝑟′ − 𝑦𝑟2

2𝜎2

Only one 𝑦𝑟 in a window 𝑊(𝑟)

𝑟For one pixel 𝑟 :

take neg. logarithm:Note, Log-function is monotonically increasing hence minimum does not change, i.e. 𝑥1 < 𝑥2 then log 𝑥1 < log 𝑥2

Page 10: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Derivation of Box Filter

30/10/2015Computer Vision I: Basics of Image Processing 10

𝑦𝑟∗ = 𝑎𝑟𝑔𝑚𝑖𝑛𝑦𝑟 ‖𝑥𝑟′ − 𝑦𝑟 ‖

2

Let us minimize:

Take derivative and set to 0:

(the average)𝑦𝑟∗

Box filter is optimal under pixel-independent, Gaussian Noise assumption and assuming that the signal is constant in a window.

𝐹 𝑦𝑟 = ‖𝑥𝑟′ − 𝑦𝑟 ‖2

factor 1/2𝜎2 is irrelevant

𝑊 means number of pixel in window 𝑊

𝜕𝐹

𝜕𝑦𝑟= −2

𝑟′

𝑥𝑟′ − 𝑦𝑟 = −2 (

𝑟′

𝑥𝑟′ − 𝑊 𝑦𝑟 ) = 0!

Page 11: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Roadmap: Basics of Digital Image Processing

• What is an Image?

• Point operators (ch. 3.1)

• Filtering: (ch. 3.2, ch 3.3, ch. 3.4)

• Linear filtering

• Non-linear filtering

• Edges detection (ch. 4.2)

• Interest Point detection (ch. 4.1.1)

30/10/2015 11Computer Vision I: Basics of Image Processing

Page 12: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Non-linear filters

• There are many different non-linear filters. (see Image Processing in SS16)

• We only look at the Median filter, Bilateral filter and Joint Bilateral Filter

30/10/2015Computer Vision I: Basics of Image Processing 12

Page 13: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Shot noise (Salt and Pepper Noise)

30/10/2015Computer Vision I: Basics of Image Processing 13

Original + shot noise(a random number of independent pixels have a random value)

Gaussian filtered

Medianfiltered

Page 14: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Another example

30/10/2015Computer Vision I: Basics of Image Processing 14

Original

Mean Median

Noisy

Page 15: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Median Filter

30/10/2015Computer Vision I: Basics of Image Processing 15

Replace each pixel with the median in a neighbourhood:

5 6 5

4 20 5

4 6 5

5 6 5

4 5 5

4 6 5

• No strong smoothing effect since values are not averaged• Very good to remove outliers (shot noise)• Used a lot for post processing of outputs (e.g. optical flow)

median

Median filter: order the values and take the middle one

Page 16: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Median Filter: Derivation

Reminder, for Gaussian noise we did solve the following Maximum Likelihood Estimation Problem:

30/10/2015Computer Vision I: Basics of Image Processing 16

𝑦𝑟∗ = 𝑎𝑟𝑔𝑚𝑎𝑥𝑦𝑟 exp[−

𝑥𝑟′ − 𝑦𝑟2

2𝜎2] = 𝑎𝑟𝑔𝑚𝑖𝑛𝑦𝑟 𝑥𝑟′ − 𝑦𝑟

2 = 1/ 𝑊 𝑥𝑟′

Mean and median are quite Different

meanmedian

𝑦𝑟∗ = 𝑎𝑟𝑔𝑚𝑎𝑥𝑦𝑟 exp[−

𝑥𝑟′ − 𝑦𝑟2𝜎2

] = 𝑎𝑟𝑔𝑚𝑖𝑛𝑦𝑟 |𝑥𝑟′ − 𝑦𝑟| = 𝑀𝑒𝑑𝑖𝑎𝑛 (𝑊 𝑟 )

For Median we solve the following problem:

This is a different noise distribution than Gaussian.

𝑝 𝑦 𝑥)

(see next slide)

Page 17: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Median Filter Derivation

30/10/2015Computer Vision I: Basics of Image Processing 17

minimize the following: function:

Problem: not differentiable ,good news: it is convex

𝐹 𝑦𝑟 = |𝑥𝑟′ − 𝑦𝑟|

Optimal solution is the median of all values

Page 18: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Bilateral Filter

30/10/2015Computer Vision I: Basics of Image Processing 18

Original + Gaussian noise Gaussian filtered Bilateral filtered

Edge over-smoothed Edge not over-smoothed

More sharp

Page 19: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Bilateral Filter – in Pictures

30/10/2015Computer Vision I: Basics of Image Processing 19

Bilateral Filter weights Output

Centre pixel

Gaussian Filter weights

Noisy input

Output (sketched)

Page 20: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Bilateral Filter – in equations

30/10/2015Computer Vision I: Basics of Image Processing 20

Filters looks at: a) distance to surrounding pixels (as Gaussian)b) Intensity of surrounding pixels

Problem: computation is slow 𝑂 𝑁𝑤 ; approximations can be done in 𝑂(𝑁)Comment: Guided filter is similar and can be computed exactly in 𝑂(𝑁)

See a tutorial on: http://people.csail.mit.edu/sparis/bf_course/

Same as Gaussian filter Consider intensity

Linear combination

Page 21: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Application: Bilateral Filter

30/10/2015Computer Vision I: Basics of Image Processing 21

Cartoonization

HDR compression (Tone mapping)

Page 22: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Joint Bilateral Filter

30/10/2015Computer Vision I: Basics of Image Processing 22

Same as Gaussian Consider intensity

f is the input image – which is processed

f is a guidance image – where we look for pixel similarity

~ ~

~

Page 23: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Application: Combine Flash and No-Flash

30/10/2015Computer Vision I: Basics of Image Processing 23

[Petschnigg et al. Siggraph ‘04]

input image 𝑓 Guidance image 𝑓

We don‘t care about absolute colors

~ Joint Bilateral Filter

~ ~

Page 24: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Reminder: Model versus Algorithm

30/10/2015Computer Vision I: Introduction 24

Goal

Given z; derive binary x:

Algorithm to minimization: 𝒙∗ = 𝑎𝑟𝑔𝑚𝑖𝑛𝑥 𝐸(𝒙)

𝒛 = 𝑅, 𝐺, 𝐵 𝑛 x= 0,1 𝑛

Model: Energy function 𝑬 𝒙 = 𝑖 𝜃𝑖 𝑥𝑖 + 𝑖,𝑗 𝜃𝑖𝑗(𝑥𝑖 , 𝑥𝑗)

Example: Interactive Image Segmentation

Page 25: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Filtering for Binary Segmentation

30/10/2015Computer Vision I: Introduction 25

Optimum with unary terms onlyDark means likely

backgroundDark means likely

foreground

𝜃𝑖(𝑥𝑖 = 0) 𝜃𝑖(𝑥𝑖 = 1)

New query image 𝑧𝑖

Page 26: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Filtering for Binary Segmentation

30/10/2015Computer Vision I: Basics of Image Processing 26

• Results are very similar: This is an alternative to energy minimization

• This can also be done for stereo, etc.

Filtered Ratio Image

Energy minimizationCost Volume filtering (Winner takes all Result)

Ratio Image 𝜃𝑖 𝑥𝑖=1

𝜃𝑖(𝑥𝑖=0)is

the Input Image 𝑓

Guidance Input Image 𝑓(also shown user brush strokes)

~

[C. Rhemann, A. Hosni, M. Bleyer, C. Rother, and M. Gelautz, Fast Cost-Volume Filtering for Visual Correspondence and Beyond, CVPR 11]

Page 27: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Roadmap: Basics of Digital Image Processing

• What is an Image?

• Point operators (ch. 3.1)

• Filtering: (ch. 3.2, ch 3.3, ch. 3.4)

• Linear filtering

• Non-linear filtering

• Edges detection (ch. 4.2)

• Interest Point detection (ch. 4.1.1)

30/10/2015 27Computer Vision I: Basics of Image Processing

Page 28: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Idealized edge types

30/10/2015Computer Vision I: Basics of Image Processing 28

We focus on this

Page 29: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

What are edges ?

• Corresponds to fast changes in the image

• The magnitude of the derivative is large

30/10/2015Computer Vision I: Basics of Image Processing 29

Image of 2 step edges

Slice through the image

Image of 2 ramp edges

Slice through the image

Page 30: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

What are fast changes in the image?

30/10/2015Computer Vision I: Basics of Image Processing 30

Image

Scanline 250

Scanline 250 smoothed with Gausian

Texture or many edges?

Edges defined after smoothing

Page 31: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Edges and Derivatives

30/10/2015Computer Vision I: Basics of Image Processing 31

We will look at thismainly

Page 32: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Edge filters in 1D

30/10/2015Computer Vision I: Basics of Image Processing 32

We can implement this as a linear filter:

Forward differences:

Central differences: -1 0 11/2

1/2 -1 1

Page 33: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Reminder: Seperable Filters

30/10/2015Computer Vision I: Basics of Image Processing 33

This is the centralizeddifference-operator

1

2

1

1

4

Page 34: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Edge Filter in 1D: Example

30/10/2015Computer Vision I: Basics of Image Processing 34

Based on 1st derivative• Smooth with Gaussian – to filter out noise• Calculate derivative• Find its optima

Page 35: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Edge Filtering in 1D

30/10/2015Computer Vision I: Basics of Image Processing 35

Simplification: (saves one operation)

Derivative of Gaussian

Page 36: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Edge Filtering in 2D

30/10/2015Computer Vision I: Basics of Image Processing 36

Page 37: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Edge Filter in 2D: Example

30/10/2015Computer Vision I: Basics of Image Processing 37

𝑥

𝑦

Page 38: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Edge Filter in 2D

30/10/2015Computer Vision I: Basics of Image Processing 38

𝑥-derivatives with different Gaussian smoothing

Page 39: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

What is a gradient

30/10/2015Computer Vision I: Basics of Image Processing 39

Page 40: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

What is a gradient

30/10/2015Computer Vision I: Basics of Image Processing 40

Page 41: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

What is a gradient

30/10/2015Computer Vision I: Basics of Image Processing 41

Page 42: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

What is a Gradient

30/10/2015Computer Vision I: Basics of Image Processing 42

Page 43: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Example – Gradient magnitude image

30/10/2015Computer Vision I: Basics of Image Processing 43

In Image Processing Lecture we look at how to get edge chains?

First smoothed with Gaussian First smoothed with broad Gaussian

Page 44: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Half-way Slide

3 minutes break

30/10/2015Computer Vision I: Basics of Image Processing 44

Page 45: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Roadmap: Basics of Digital Image Processing

• What is an Image?

• Point operators (ch. 3.1)

• Filtering: (ch. 3.2, ch 3.3, ch. 3.4)

• Linear filtering

• Non-linear filtering

• Edges detection (ch. 4.2)

• Interest Point detection (ch. 4.1.1)

30/10/2015 45Computer Vision I: Basics of Image Processing

Page 46: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

What region should we try to match?

30/10/2015Computer Vision I: Basics of Image Processing 46

Look for a region that is unique, i.e. not ambiguous

We want to find a few regions where this image pair matches (applications later)

Page 47: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Goal: Interest Point Detection

• Goal: predict a few “interest points” in order to remove redundant data efficiently

30/10/2015Computer Vision I: Basics of Image Processing 47

Should be invariant against:

a. Geometric transformation – scaling, rotation, translation, affine transformation, projective transformation etc.

b. Color transformation – additive (lightning change), multiplicative (contrast), linear (both), monotone etc.;

c. Discretization (e.g. spatial resolution, focus);

Page 48: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Points versus Lines

30/10/2015Computer Vision I: Basics of Image Processing 48

„Apeture problem“

Lines are not as good as points

?

Page 49: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Harris Corner Detector – Basic Idea

30/10/2015Computer Vision I: Basics of Image Processing 49

[Szeliski and Seitz]

Local measure of feature uniqueness: Shifting the window in any direction: How does it change?

Page 50: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

30/10/2015Computer Vision I: Basics of Image Processing 50

Harris Corner Detector

How similar is a local window with its neighbor?

Auto-correlation function:

is a small window around

is a convolution kernel and used to decrease the influence of pixels far from , e.g. with GaussianFor simplicity we use for now = 1.

Δ𝑥

(𝑥, 𝑦)Δ𝑦

W

Page 51: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Harris Corner Detector

30/10/2015Computer Vision I: Basics of Image Processing 51

One is interested in properties of at each position We could evaluate for all discrete shifts = +/-1. But we would like to do smaller shifts and have a fast method.

Let us look at a linear approximation of , i.e. theTaylor expansion around

+ 𝜖(Δ𝑥, Δ𝑦)

Gradient at (𝑢, 𝑣)

Page 52: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Reminder: Taylor Expansion

30/10/2015Computer Vision I: Basics of Image Processing 52

A function 𝑓(𝑥) is approximated by:

𝑓 𝑥 ~

𝑛

𝑓 𝑛 𝑎

𝑛!𝑥 − 𝑎 𝑛

The approximation is most accurate at point 𝑎

Page 53: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Harris Corner Detector

30/10/2015Computer Vision I: Basics of Image Processing 53

Put it together:

with

Q is call the Structure Tensor

We compute this at any image location (𝑥, 𝑦)

Page 54: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Harris Corner Detector

30/10/2015Computer Vision I: Basics of Image Processing 54

The auto-correlation function

Function c is (after approximation) a quadratic function in and

• Isolines are ellipses ( is symmetric and positive definite)• Eigenvector 𝑥1 with (larger) Eigenvalue 𝜆1 is the direction of fastest change in

function 𝑐• Eigenvector 𝑥2 with (smaller) Eigenvalue 𝜆2 is direction of slowest change in

function 𝑐

Δ𝑥

Δy

Function c

𝑥2

𝑥1

Note 𝑐 = 0 for Δ𝑥 = Δy = 0

Page 55: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Harris Corner Detector

30/10/2015Computer Vision I: Basics of Image Processing 55

Some examples – isolines for :

(a) Flat (b) Edges (c) Corners

a. Homogenous regions: both -s are small

b. Edges: one is small the other one is large

c. Corners: both -s are large (this is what we are looking for!)

Page 56: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Harris Corner Detector

30/10/2015Computer Vision I: Basics of Image Processing 56

Zoom in

(smaller eigenvalue)(larger eigenvalue)𝜆1 𝜆2Image

Page 57: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Harris Corner Detector

30/10/2015Computer Vision I: Basics of Image Processing 57

“Cornerness” is a characteristic of

Proposition by Harris:

Downweights edges where 𝜆1 ≫ 𝜆2

Smallest eigenvalueHarris Value

Page 58: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Harris Corners - Example

30/10/2015Computer Vision I: Basics of Image Processing 58

Page 59: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

H-score (red- high, blue - low)

30/10/2015Computer Vision I: Basics of Image Processing 59

Page 60: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Threshold (H-score > value)

30/10/2015Computer Vision I: Basics of Image Processing 60

Page 61: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Non-maximum suppression

30/10/2015Computer Vision I: Basics of Image Processing 61

(all points are set to 0 for which a higher H-score in a window-neighborhood exists)

Page 62: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Harris Corners in Red

30/10/2015Computer Vision: Algorithms and Applications --

- Carsten Rother62

Page 63: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Other examples

30/10/2015Computer Vision I: Basics of Image Processing 63

Page 64: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Maximally stable “extremal regions”

30/10/2015Computer Vision I: Basics of Image Processing 64

• Invariant to affine transformation of gray-values• Both small and large structures are detected

Page 65: Computer Vision I - Filtering and Feature detection · •Linear filtering •Non-linear filtering •Edges detection (ch. 4.2) •Interest Point detection (ch. 4.1.1) Computer Vision

Literature

30/10/2015Computer Vision I: Basics of Image Processing 65

There is a large body of literature on detectors and descriptors (later lecture)

A comparison paper (e.g. what is the most robust corner detectors):

K. Mikolajczyk, T. Tuytelaars, C. Schmid, A. Zisserman, J. Matas, F. Schaffalitzky, T. Kadir: A Comparison of Affine Region Detectors (IJCV 2006)