Cameras and Images Sanja Fidler Intro to Image Understanding 1 / - - PowerPoint PPT Presentation

cameras and images
SMART_READER_LITE
LIVE PREVIEW

Cameras and Images Sanja Fidler Intro to Image Understanding 1 / - - PowerPoint PPT Presentation

Cameras and Images Sanja Fidler Intro to Image Understanding 1 / 57 Pinhole Camera [Source: A. Torralba] Make your own camera http://www.foundphotography.com/PhotoThoughts/ archives/2005/04/pinhole_camera_2.html Sanja Fidler Intro to Image


slide-1
SLIDE 1

Cameras and Images

Sanja Fidler Intro to Image Understanding 1 / 57

slide-2
SLIDE 2

Pinhole Camera

[Source: A. Torralba]

Make your own camera http://www.foundphotography.com/PhotoThoughts/ archives/2005/04/pinhole_camera_2.html

Sanja Fidler Intro to Image Understanding 2 / 57

slide-3
SLIDE 3

Pinhole Camera

[Source: A. Torralba]

How it works The pinhole camera only allows rays from one point in the scene to strike each point of the paper.

Sanja Fidler Intro to Image Understanding 3 / 57

slide-4
SLIDE 4

Pinhole Camera

[Source: A. Torralba]

Sanja Fidler Intro to Image Understanding 4 / 57

slide-5
SLIDE 5

Pinhole Camera

[Source: A. Torralba]

Example

Sanja Fidler Intro to Image Understanding 5 / 57

slide-6
SLIDE 6

Pinhole Camera

[Source: A. Torralba]

Example

Sanja Fidler Intro to Image Understanding 6 / 57

slide-7
SLIDE 7

Pinhole Camera

[Source: A. Torralba]

Example

Sanja Fidler Intro to Image Understanding 7 / 57

slide-8
SLIDE 8

Pinhole Camera

[Source: A. Torralba]

Remember this example? In this case the window acts as a pinhole camera into the room

Sanja Fidler Intro to Image Understanding 8 / 57

slide-9
SLIDE 9

Digital Camera

[Adopted from S. Seitz]

A digital camera replaces film with a sensor array Each cell in the array is light-sensitive diode that converts photons to electrons http://electronics.howstuffworks.com/ cameras-photography/digital/digital-camera.htm

Sanja Fidler Intro to Image Understanding 9 / 57

slide-10
SLIDE 10

Image Formation

Image formation process producing a particular image depends on: lighting conditions scene geometry surface properties camera optics

Sanja Fidler Intro to Image Understanding 10 / 57

slide-11
SLIDE 11

Digital Image

Continuous image projected to sensor array Sampling and quantization

http://pho.to/media/images/digital/digital-sensors.jpg

Sample the 2D space on a regular grid Quantize each sample (round to nearest integer)

Sanja Fidler Intro to Image Understanding 11 / 57

slide-12
SLIDE 12

Digital Image

Image is a matrix with integer values We will typically denote it with I

Sanja Fidler Intro to Image Understanding 12 / 57

slide-13
SLIDE 13

Digital Image

Image is a matrix with integer values We will typically denote it with I I(i, j) is called intensity

Sanja Fidler Intro to Image Understanding 12 / 57

slide-14
SLIDE 14

Digital Image

Image is a matrix with integer values We will typically denote it with I I(i, j) is called intensity Matrix I can be m × n (grayscale)

Sanja Fidler Intro to Image Understanding 12 / 57

slide-15
SLIDE 15

Digital Image

Image is a matrix with integer values We will typically denote it with I I(i, j) is called intensity Matrix I can be m × n (grayscale)

  • r m × n × 3 (color)

Sanja Fidler Intro to Image Understanding 12 / 57

slide-16
SLIDE 16

Digital Image

Image is a matrix with integer values We will typically denote it with I I(i, j) is called intensity Matrix I can be m × n (grayscale)

  • r m × n × 3 (color)

Sanja Fidler Intro to Image Understanding 12 / 57

slide-17
SLIDE 17

Intensity

We can think of a (grayscale) image as a function f : R2 → R giving the intensity at position (i, j) Intensity 0 is black and 255 is white

Sanja Fidler Intro to Image Understanding 13 / 57

slide-18
SLIDE 18

Image Transformations

As with any function, we can apply operators to an image, e.g.: We’ll talk about special kinds of operators, correlation and convolution (linear filtering) [Adapted from: N. Snavely]

Sanja Fidler Intro to Image Understanding 14 / 57

slide-19
SLIDE 19

Linear Filters

Reading: Szeliski book, Chapter 3.2

Sanja Fidler Intro to Image Understanding 15 / 57

slide-20
SLIDE 20

Motivation: Finding Waldo

How can we find Waldo?

[Source: R. Urtasun]

Sanja Fidler Intro to Image Understanding 16 / 57

slide-21
SLIDE 21

Answer

Slide and compare! In formal language: filtering

Sanja Fidler Intro to Image Understanding 17 / 57

slide-22
SLIDE 22

Motivation: Noise reduction

Given a camera and a still scene, how can you reduce noise? [Source: S. Seitz]

Sanja Fidler Intro to Image Understanding 18 / 57

slide-23
SLIDE 23

Image Filtering

Modify the pixels in an image based on some function of a local neighborhood of each pixel In other words... Filtering

!" #" $" #" %" #" !" &" #'" ()*+,"-.+/0"1+2+" %" 3)1-401"-.+/0"1+2+" 5).0"678*9)8"

[Source: L. Zhang]

Sanja Fidler Intro to Image Understanding 19 / 57

slide-24
SLIDE 24

Applications of Filtering

Detect patterns, e.g., template matching. Enhance an image, e.g., denoise, resize. Extract information, e.g., texture, edges.

Sanja Fidler Intro to Image Understanding 20 / 57

slide-25
SLIDE 25

Noise reduction

Simplest thing: replace each pixel by the average of its neighbors. This assumes that neighboring pixels are similar, and the noise to be independent from pixel to pixel. [Source: S. Marschner]

Sanja Fidler Intro to Image Understanding 21 / 57

slide-26
SLIDE 26

Noise reduction

Simplest thing: replace each pixel by the average of its neighbors. This assumes that neighboring pixels are similar, and the noise to be independent from pixel to pixel. [Source: S. Marschner]

Sanja Fidler Intro to Image Understanding 21 / 57

slide-27
SLIDE 27

Noise reduction

Simplest thing: replace each pixel by the average of its neighbors This assumes that neighboring pixels are similar, and the noise to be independent from pixel to pixel. Moving average in 1D: [1, 1, 1, 1, 1]/5 [Source: S. Marschner]

Sanja Fidler Intro to Image Understanding 22 / 57

slide-28
SLIDE 28

Noise reduction

Simplest thing: replace each pixel by the average of its neighbors This assumes that neighboring pixels are similar, and the noise to be independent from pixel to pixel. Non-uniform weights [1, 4, 6, 4, 1] / 16 [Source: S. Marschner]

Sanja Fidler Intro to Image Understanding 23 / 57

slide-29
SLIDE 29

Moving Average in 2D

[Source: S. Seitz]

Sanja Fidler Intro to Image Understanding 24 / 57

slide-30
SLIDE 30

Moving Average in 2D

[Source: S. Seitz]

Sanja Fidler Intro to Image Understanding 24 / 57

slide-31
SLIDE 31

Moving Average in 2D

[Source: S. Seitz]

Sanja Fidler Intro to Image Understanding 24 / 57

slide-32
SLIDE 32

Moving Average in 2D

[Source: S. Seitz]

Sanja Fidler Intro to Image Understanding 24 / 57

slide-33
SLIDE 33

Moving Average in 2D

[Source: S. Seitz]

Sanja Fidler Intro to Image Understanding 24 / 57

slide-34
SLIDE 34

Moving Average in 2D

[Source: S. Seitz]

Sanja Fidler Intro to Image Understanding 24 / 57

slide-35
SLIDE 35

Linear Filtering: Correlation

Involves weighted combinations of pixels in small neighborhoods: G(i, j) = 1 (2k + 1)2

k

  • u=−k

k

  • v=−k

I(i + u, j + v) The output pixels value is determined as a weighted sum of input pixel values G(i, j) =

k

  • u=−k

k

  • v=−k

F(u, v) · I(i + u, j + v)

Sanja Fidler Intro to Image Understanding 25 / 57

slide-36
SLIDE 36

Linear Filtering: Correlation

Involves weighted combinations of pixels in small neighborhoods: G(i, j) = 1 (2k + 1)2

k

  • u=−k

k

  • v=−k

I(i + u, j + v) The output pixels value is determined as a weighted sum of input pixel values G(i, j) =

k

  • u=−k

k

  • v=−k

F(u, v) · I(i + u, j + v) The entries of the weight kernel or mask F(u, v) are often called the filter coefficients.

Sanja Fidler Intro to Image Understanding 25 / 57

slide-37
SLIDE 37

Linear Filtering: Correlation

Involves weighted combinations of pixels in small neighborhoods: G(i, j) = 1 (2k + 1)2

k

  • u=−k

k

  • v=−k

I(i + u, j + v) The output pixels value is determined as a weighted sum of input pixel values G(i, j) =

k

  • u=−k

k

  • v=−k

F(u, v) · I(i + u, j + v) The entries of the weight kernel or mask F(u, v) are often called the filter coefficients. This operator is the correlation operator G = F ⊗ I

Sanja Fidler Intro to Image Understanding 25 / 57

slide-38
SLIDE 38

Linear Filtering: Correlation

Involves weighted combinations of pixels in small neighborhoods: G(i, j) = 1 (2k + 1)2

k

  • u=−k

k

  • v=−k

I(i + u, j + v) The output pixels value is determined as a weighted sum of input pixel values G(i, j) =

k

  • u=−k

k

  • v=−k

F(u, v) · I(i + u, j + v) The entries of the weight kernel or mask F(u, v) are often called the filter coefficients. This operator is the correlation operator G = F ⊗ I

Sanja Fidler Intro to Image Understanding 25 / 57

slide-39
SLIDE 39

Linear Filtering: Correlation

It’s really easy!

Sanja Fidler Intro to Image Understanding 26 / 57

slide-40
SLIDE 40

Linear Filtering: Correlation

It’s really easy!

Sanja Fidler Intro to Image Understanding 26 / 57

slide-41
SLIDE 41

Linear Filtering: Correlation

It’s really easy!

Sanja Fidler Intro to Image Understanding 26 / 57

slide-42
SLIDE 42

Linear Filtering: Correlation

It’s really easy! G(i, j) =

k

  • u=−k

k

  • v=−k

F(u, v) · I(i + u, j + v)

Sanja Fidler Intro to Image Understanding 26 / 57

slide-43
SLIDE 43

Example

What’s the result? [Source: D. Lowe]

Sanja Fidler Intro to Image Understanding 27 / 57

slide-44
SLIDE 44

Example

What’s the result? [Source: D. Lowe]

Sanja Fidler Intro to Image Understanding 27 / 57

slide-45
SLIDE 45

Example

What’s the result? [Source: D. Lowe]

Sanja Fidler Intro to Image Understanding 27 / 57

slide-46
SLIDE 46

Example

What’s the result? [Source: D. Lowe]

Sanja Fidler Intro to Image Understanding 27 / 57

slide-47
SLIDE 47

Example

What’s the result?

Original! !" !" !" !" !" !" !" !" !" #" #" #" #" $" #" #" #" #"

  • !

%"

*

[Source: D. Lowe]

Sanja Fidler Intro to Image Understanding 27 / 57

slide-48
SLIDE 48

Example

What’s the result?

Original! !" !" !" !" !" !" !" !" !" #" #" #" #" $" #" #" #" #"

  • !

!"#$%&'(')*+,-&$* %&''()*+&*(,"(-.(,/*

0"

*

[Source: D. Lowe]

Sanja Fidler Intro to Image Understanding 27 / 57

slide-49
SLIDE 49

Sharpening

[Source: D. Lowe]

Sanja Fidler Intro to Image Understanding 28 / 57

slide-50
SLIDE 50

Example of Correlation

What is the result of filtering the impulse signal (image) I with the arbitrary filter F? [Source: K. Grauman]

Sanja Fidler Intro to Image Understanding 29 / 57

slide-51
SLIDE 51

Smoothing by averaging

What if the filter size was 5 x 5 instead of 3 x 3? [Source: K. Graumann]

Sanja Fidler Intro to Image Understanding 30 / 57

slide-52
SLIDE 52

Gaussian filter

What if we want nearest neighboring pixels to have the most influence

  • n the output?

Removes high-frequency components from the image (low-pass filter). [Source: S. Seitz]

Sanja Fidler Intro to Image Understanding 31 / 57

slide-53
SLIDE 53

Smoothing with a Gaussian

[Source: K. Grauman]

Sanja Fidler Intro to Image Understanding 32 / 57

slide-54
SLIDE 54

Mean vs Gaussian

Sanja Fidler Intro to Image Understanding 33 / 57

slide-55
SLIDE 55

Gaussian filter: Parameters

Size of filter or mask: Gaussian function has infinite support, but discrete filters use finite kernels. [Source: K. Grauman]

Sanja Fidler Intro to Image Understanding 34 / 57

slide-56
SLIDE 56

Gaussian filter: Parameters

Variance of the Gaussian: determines extent of smoothing. [Source: K. Grauman]

Sanja Fidler Intro to Image Understanding 35 / 57

slide-57
SLIDE 57

Gaussian filter: Parameters

[Source: K. Grauman]

Sanja Fidler Intro to Image Understanding 36 / 57

slide-58
SLIDE 58

Is this the most general Gaussian?

No, the most general form for x ∈ ℜd N (x; µ, Σ) = 1 (2π)d/2|Σ|1/2 exp

  • −1

2(x − µ)TΣ−1(x − µ)

  • But the simplified version is typically use for filtering.

Sanja Fidler Intro to Image Understanding 37 / 57

slide-59
SLIDE 59

Properties of the Smoothing

All values are positive. They all sum to 1.

Sanja Fidler Intro to Image Understanding 38 / 57

slide-60
SLIDE 60

Properties of the Smoothing

All values are positive. They all sum to 1. Amount of smoothing proportional to mask size.

Sanja Fidler Intro to Image Understanding 38 / 57

slide-61
SLIDE 61

Properties of the Smoothing

All values are positive. They all sum to 1. Amount of smoothing proportional to mask size. Remove high-frequency components; low-pass filter.

Sanja Fidler Intro to Image Understanding 38 / 57

slide-62
SLIDE 62

Properties of the Smoothing

All values are positive. They all sum to 1. Amount of smoothing proportional to mask size. Remove high-frequency components; low-pass filter.

Sanja Fidler Intro to Image Understanding 38 / 57

slide-63
SLIDE 63

Finding Waldo

image I filter F Let’s do normalized cross-correlation

Sanja Fidler Intro to Image Understanding 39 / 57

slide-64
SLIDE 64

Finding Waldo

Result

Sanja Fidler Intro to Image Understanding 39 / 57

slide-65
SLIDE 65

Finding Waldo

Result

Sanja Fidler Intro to Image Understanding 39 / 57

slide-66
SLIDE 66

Finding Waldo

Voila! Homework: Do it yourself! Code on class webpage. Don’t cheat ;)

Sanja Fidler Intro to Image Understanding 39 / 57

slide-67
SLIDE 67

Convolution

Convolution operator G(i, j) =

k

  • u=−k

k

  • v=−k

F(u, v) · I(i − u, j − v) Equivalent to flipping the filter in both dimensions (bottom to top, right to left) and apply correlation.

Sanja Fidler Intro to Image Understanding 40 / 57

slide-68
SLIDE 68

Convolution

Convolution operator G(i, j) =

k

  • u=−k

k

  • v=−k

F(u, v) · I(i − u, j − v) Equivalent to flipping the filter in both dimensions (bottom to top, right to left) and apply correlation. If filter is symmetric, then correlation and convolution are the same

Sanja Fidler Intro to Image Understanding 40 / 57

slide-69
SLIDE 69

Convolution

Convolution operator G(i, j) =

k

  • u=−k

k

  • v=−k

F(u, v) · I(i − u, j − v) Equivalent to flipping the filter in both dimensions (bottom to top, right to left) and apply correlation. If filter is symmetric, then correlation and convolution are the same

Sanja Fidler Intro to Image Understanding 40 / 57

slide-70
SLIDE 70

Correlation vs Convolution

For a Gaussian or box filter, how will the outputs differ? If the input is an impulse signal, how will the outputs differ? δ ∗ I?, and δ ⊗ I?

Sanja Fidler Intro to Image Understanding 41 / 57

slide-71
SLIDE 71

”Optical” Convolution

Camera Shake

*

!"

Figure: Fergus, et al., SIGGRAPH 2006

Blur in out-of-focus regions of an image.

Figure: Bokeh: http://lullaby.homepage.dk/diy-camera/bokeh.html Click for more info

[Source: N. Snavely]

Sanja Fidler Intro to Image Understanding 42 / 57

slide-72
SLIDE 72

Properties of Convolution

Commutative : f ∗ g = g ∗ f Associative : f ∗ (g ∗ h) = (f ∗ g) ∗ h Distributive : f ∗ (g + h) = f ∗ g + f ∗ h

  • Assoc. with scalar multiplier : λ · (f ∗ g) = (λ · f ) ∗ h

The Fourier transform of two convolved images is the product of their individual Fourier transforms: F(f ∗ g) = F(f ) · F(g)

Sanja Fidler Intro to Image Understanding 43 / 57

slide-73
SLIDE 73

Properties of Convolution

Commutative : f ∗ g = g ∗ f Associative : f ∗ (g ∗ h) = (f ∗ g) ∗ h Distributive : f ∗ (g + h) = f ∗ g + f ∗ h

  • Assoc. with scalar multiplier : λ · (f ∗ g) = (λ · f ) ∗ h

The Fourier transform of two convolved images is the product of their individual Fourier transforms: F(f ∗ g) = F(f ) · F(g) Homework: Why is this good news? Hint: Think of complexity of convolution and Fourier Transform Both correlation and convolution are linear shift-invariant (LSI)

  • perators: the effect of the operator is the same everywhere.

Sanja Fidler Intro to Image Understanding 43 / 57

slide-74
SLIDE 74

Properties of Convolution

Commutative : f ∗ g = g ∗ f Associative : f ∗ (g ∗ h) = (f ∗ g) ∗ h Distributive : f ∗ (g + h) = f ∗ g + f ∗ h

  • Assoc. with scalar multiplier : λ · (f ∗ g) = (λ · f ) ∗ h

The Fourier transform of two convolved images is the product of their individual Fourier transforms: F(f ∗ g) = F(f ) · F(g) Homework: Why is this good news? Hint: Think of complexity of convolution and Fourier Transform Both correlation and convolution are linear shift-invariant (LSI)

  • perators: the effect of the operator is the same everywhere.

Sanja Fidler Intro to Image Understanding 43 / 57

slide-75
SLIDE 75

Gaussian Filter

Convolution with itself is another Gaussian

*

!"

Convolving twice with Gaussian kernel of width σ is the same as convolving once with kernel of width σ √ 2 We don’t need to filter twice, just once with a bigger kernel [Source: K. Grauman]

Sanja Fidler Intro to Image Understanding 44 / 57

slide-76
SLIDE 76

Boundary Effects

What happens at the border of the image? What’s the size of the

  • utput matrix?

MATLAB: filter2(g, f, shape) shape = “full” output size is sum of sizes of f and g shape = “same”: output size is same as f shape = “valid”: output size is difference of sizes of f and g

[Source: S. Lazebnik]

Sanja Fidler Intro to Image Understanding 45 / 57

slide-77
SLIDE 77

Boundary Effects

What happens at the border of the image? What’s the size of the

  • utput matrix?

MATLAB: filter2(g, f, shape) shape = “full” output size is sum of sizes of f and g shape = “same”: output size is same as f shape = “valid”: output size is difference of sizes of f and g

[Source: S. Lazebnik]

Sanja Fidler Intro to Image Understanding 45 / 57

slide-78
SLIDE 78

Matrix Form

Remember correlation: G(i, j) =

k

  • u=−k

k

  • v=−k

F(u, v) · I(i + u, j + v) Can we write that in a more compact form (with vectors)?

Sanja Fidler Intro to Image Understanding 46 / 57

slide-79
SLIDE 79

Matrix Form

Remember correlation: G(i, j) =

k

  • u=−k

k

  • v=−k

F(u, v) · I(i + u, j + v) Can we write that in a more compact form (with vectors)? Define f = F(:), Tij = I(i − k : i + k, j − k : j + k), and tij = Tij(:) G(i, j) = fT · tij where · is a dot product

Sanja Fidler Intro to Image Understanding 46 / 57

slide-80
SLIDE 80

Matrix Form

Remember correlation: G(i, j) =

k

  • u=−k

k

  • v=−k

F(u, v) · I(i + u, j + v) Can we write that in a more compact form (with vectors)? Define f = F(:), Tij = I(i − k : i + k, j − k : j + k), and tij = Tij(:) G(i, j) = fT · tij where · is a dot product Homework: Can we write full correlation G = F ⊗ I in matrix form?

Sanja Fidler Intro to Image Understanding 46 / 57

slide-81
SLIDE 81

Matrix Form

Remember correlation: G(i, j) =

k

  • u=−k

k

  • v=−k

F(u, v) · I(i + u, j + v) Can we write that in a more compact form (with vectors)? Define f = F(:), Tij = I(i − k : i + k, j − k : j + k), and tij = Tij(:) G(i, j) = fT · tij where · is a dot product Homework: Can we write full correlation G = F ⊗ I in matrix form?

Sanja Fidler Intro to Image Understanding 46 / 57

slide-82
SLIDE 82

Separable Filters: Speed-up Trick!

The process of performing a convolution requires K 2 operations per pixel, where K is the size (width or height) of the convolution filter. Can we do faster?

Sanja Fidler Intro to Image Understanding 47 / 57

slide-83
SLIDE 83

Separable Filters: Speed-up Trick!

The process of performing a convolution requires K 2 operations per pixel, where K is the size (width or height) of the convolution filter. Can we do faster? In many cases (not all!), this operation can be speed up by first performing a 1D horizontal convolution followed by a 1D vertical convolution, requiring only 2K operations.

Sanja Fidler Intro to Image Understanding 47 / 57

slide-84
SLIDE 84

Separable Filters: Speed-up Trick!

The process of performing a convolution requires K 2 operations per pixel, where K is the size (width or height) of the convolution filter. Can we do faster? In many cases (not all!), this operation can be speed up by first performing a 1D horizontal convolution followed by a 1D vertical convolution, requiring only 2K operations. If this is possible, then the convolution filter is called separable.

Sanja Fidler Intro to Image Understanding 47 / 57

slide-85
SLIDE 85

Separable Filters: Speed-up Trick!

The process of performing a convolution requires K 2 operations per pixel, where K is the size (width or height) of the convolution filter. Can we do faster? In many cases (not all!), this operation can be speed up by first performing a 1D horizontal convolution followed by a 1D vertical convolution, requiring only 2K operations. If this is possible, then the convolution filter is called separable. And it is the outer product of two filters: F = v hT Homework: Think why in the case of separable filters 2D convolution is the same as two 1D convolutions

[Source: R. Urtasun]

Sanja Fidler Intro to Image Understanding 47 / 57

slide-86
SLIDE 86

Separable Filters: Speed-up Trick!

The process of performing a convolution requires K 2 operations per pixel, where K is the size (width or height) of the convolution filter. Can we do faster? In many cases (not all!), this operation can be speed up by first performing a 1D horizontal convolution followed by a 1D vertical convolution, requiring only 2K operations. If this is possible, then the convolution filter is called separable. And it is the outer product of two filters: F = v hT Homework: Think why in the case of separable filters 2D convolution is the same as two 1D convolutions

[Source: R. Urtasun]

Sanja Fidler Intro to Image Understanding 47 / 57

slide-87
SLIDE 87

How it Works

Sanja Fidler Intro to Image Understanding 48 / 57

slide-88
SLIDE 88

How it Works

Sanja Fidler Intro to Image Understanding 48 / 57

slide-89
SLIDE 89

How it Works

Sanja Fidler Intro to Image Understanding 48 / 57

slide-90
SLIDE 90

How it Works

Sanja Fidler Intro to Image Understanding 48 / 57

slide-91
SLIDE 91

Separable Filters: Gaussian filters

One famous separable filter we already know:

Gaussian : f (x, y) =

1 2πσ2 e− x2+y2

σ2

=

  • 1

√ 2πσe− x2

σ2

·

  • 1

√ 2πσe− y2

σ2

Sanja Fidler Intro to Image Understanding 49 / 57

slide-92
SLIDE 92

Let’s play a game...

Is this separable? If yes, what’s the separable version?

[Source: R. Urtasun]

Sanja Fidler Intro to Image Understanding 50 / 57

slide-93
SLIDE 93

Let’s play a game...

Is this separable? If yes, what’s the separable version? What does this filter do?

[Source: R. Urtasun]

Sanja Fidler Intro to Image Understanding 50 / 57

slide-94
SLIDE 94

Let’s play a game...

Is this separable? If yes, what’s the separable version?

[Source: R. Urtasun]

Sanja Fidler Intro to Image Understanding 51 / 57

slide-95
SLIDE 95

Let’s play a game...

Is this separable? If yes, what’s the separable version? What does this filter do?

[Source: R. Urtasun]

Sanja Fidler Intro to Image Understanding 51 / 57

slide-96
SLIDE 96

Let’s play a game...

Is this separable? If yes, what’s the separable version?

[Source: R. Urtasun]

Sanja Fidler Intro to Image Understanding 52 / 57

slide-97
SLIDE 97

Let’s play a game...

Is this separable? If yes, what’s the separable version? What does this filter do?

[Source: R. Urtasun]

Sanja Fidler Intro to Image Understanding 52 / 57

slide-98
SLIDE 98

How can we tell if a given filter F is indeed separable?

Inspection... this is what we were doing. Looking at the analytic form of it.

Sanja Fidler Intro to Image Understanding 53 / 57

slide-99
SLIDE 99

How can we tell if a given filter F is indeed separable?

Inspection... this is what we were doing. Looking at the analytic form of it. Look at the singular value decomposition (SVD), and if only one singular value is non-zero, then it is separable F = UΣVT =

  • i

σiuivT

i

with Σ = diag(σi).

Sanja Fidler Intro to Image Understanding 53 / 57

slide-100
SLIDE 100

How can we tell if a given filter F is indeed separable?

Inspection... this is what we were doing. Looking at the analytic form of it. Look at the singular value decomposition (SVD), and if only one singular value is non-zero, then it is separable F = UΣVT =

  • i

σiuivT

i

with Σ = diag(σi). Matlab: [U,S,V] = svd(F);

Sanja Fidler Intro to Image Understanding 53 / 57

slide-101
SLIDE 101

How can we tell if a given filter F is indeed separable?

Inspection... this is what we were doing. Looking at the analytic form of it. Look at the singular value decomposition (SVD), and if only one singular value is non-zero, then it is separable F = UΣVT =

  • i

σiuivT

i

with Σ = diag(σi). Matlab: [U,S,V] = svd(F); √σ1u1 and √σ1vT

1 are the vertical and horizontal filter.

[Source: R. Urtasun]

Sanja Fidler Intro to Image Understanding 53 / 57

slide-102
SLIDE 102

How can we tell if a given filter F is indeed separable?

Inspection... this is what we were doing. Looking at the analytic form of it. Look at the singular value decomposition (SVD), and if only one singular value is non-zero, then it is separable F = UΣVT =

  • i

σiuivT

i

with Σ = diag(σi). Matlab: [U,S,V] = svd(F); √σ1u1 and √σ1vT

1 are the vertical and horizontal filter.

[Source: R. Urtasun]

Sanja Fidler Intro to Image Understanding 53 / 57

slide-103
SLIDE 103

Sharpening revisited

What does blurring take away?

!"#$#%&'( )*!!+,-.(/0102(

!"

.-+&#'(

#"

Let’s add it back

!"#$%&'&()

!"

*$+,+'#-) (&.#+-)

#"$"

[Source: S. Lazebnik]

Sanja Fidler Intro to Image Understanding 54 / 57

slide-104
SLIDE 104

Sharpening

!"#$%&'&() #$%&'&()

[Source: N. Snavely]

Sanja Fidler Intro to Image Understanding 55 / 57

slide-105
SLIDE 105

Summary – Stuff You Should Know

Correlation: Slide a filter across image and compare (via dot product) Convolution: Flip the filter to the right and down and do correlation Smooth image with a Gaussian kernel: bigger σ means more blurring Some filters (like Gaussian) are separable: you can filter faster. First apply 1D convolution to each row, followed by another 1D conv. to each column Applying first a Gaussian filter with σ1 and then another Gaussian with σ2 is the same as applying one Gaussian filter with σ =

  • σ2

1 + σ2 2

Matlab functions:

imfilter: can do both correlation and convolution corr2, filter2: correlation, normxcorr2 normalized correlation conv2: does correlation fspecial: creates special filters including a Gaussian

Sanja Fidler Intro to Image Understanding 56 / 57

slide-106
SLIDE 106

Next time:

Edge Detection

Sanja Fidler Intro to Image Understanding 57 / 57