Topic 4: Topic 4: Local analysis of image Local analysis of image - - PowerPoint PPT Presentation

topic 4 topic 4 local analysis of image local analysis of
SMART_READER_LITE
LIVE PREVIEW

Topic 4: Topic 4: Local analysis of image Local analysis of image - - PowerPoint PPT Presentation

Topic 4: Topic 4: Local analysis of image Local analysis of image patches patches patches patches What do we mean by an image patch? What do we mean by an image patch? Applications of local image analysis


slide-1
SLIDE 1

Topic 4: Topic 4: Local analysis of image Local analysis of image patches patches patches patches

  • What do we mean by an image “patch”?

What do we mean by an image “patch”?

  • Applications of local image analysis

Applications of local image analysis

  • Visualizing 1D and 2D intensity functions

Visualizing 1D and 2D intensity functions

slide-2
SLIDE 2

Local Image Patches Local Image Patches

So far, we have considered pixels completely independently

  • f each other (as RGB values or, as vectors [R, G, B])

In reality, photos have a great deal of structure This structure can be analyzed at a local level (eg., small groups of nearby pixels) or a global one (eg. entire image) pixel pixel

slide-3
SLIDE 3

Local Image Patches Local Image Patches

Qualitatively, we can think of many different types of patches in an image Patches corresponding to a “corner” in the image

slide-4
SLIDE 4

Local Image Patches Local Image Patches

Qualitatively, we can think of many different types of patches in an image Patches corresponding to an “edge” in the image

slide-5
SLIDE 5

Local Image Patches Local Image Patches

Qualitatively, we can think of many different types of patches in an image Patches of uniform texture

slide-6
SLIDE 6

Local Image Patches Local Image Patches

Qualitatively, we can think of many different types of patches in an image Patches that originate from a single surface

slide-7
SLIDE 7

Local Image Patches Local Image Patches

Qualitatively, we can think of many different types of patches in an image Or patches with perceptually-significant “features”

slide-8
SLIDE 8

Local Image Patches Local Image Patches

When is a group of pixels considered a local patch? The notion of a patch is relative. It can be a single pixel

slide-9
SLIDE 9

Local Image Patches Local Image Patches

When is a group of pixels considered a local patch? There is no answer to this question! The notion of a patch is relative. It can be a single pixel

slide-10
SLIDE 10

Local Image Patches Local Image Patches

When is a group of pixels considered a local patch? There is no answer to this question! The notion of a patch is relative. It can be the entire image

slide-11
SLIDE 11

Local Image Patches Local Image Patches

We will begin with mathematical properties and methods that apply mostly to very small patches (e.g., 3x3) … and eventually consider descriptions that apply to entire images

slide-12
SLIDE 12

Topic 4: Topic 4: Local analysis of image Local analysis of image patches patches patches patches

  • What do we mean by an image “patch”?

What do we mean by an image “patch”?

  • Applications of local image analysis

Applications of local image analysis

  • Visualizing 1D and 2D intensity functions

Visualizing 1D and 2D intensity functions

slide-13
SLIDE 13

Patches: Why Do We Care? Patches: Why Do We Care?

Many applications…

  • Recognition
  • Inspection
  • Video-based tracking
  • Special effects
slide-14
SLIDE 14

Face Recognition and Analysis Face Recognition and Analysis

http://petapixel.com/2012/03/30/facial-recognition-software-guesses-age-based-on-a-photo/

slide-15
SLIDE 15

Tracking Tracking

  • M. Zervos, H. BenShitrit and P. Fua, Real time multi-object tracking using multiple cameras
slide-16
SLIDE 16

Editing & Manipulating Photos Editing & Manipulating Photos

Object removal from a photo

Original Original New New

(Criminisi et al, CVPR 2003)

slide-17
SLIDE 17

Editing & Manipulating Photos Editing & Manipulating Photos

Colorization of black and white photos

Original (B&W) Original (B&W) New (Color) New (Color)

(Levin & Weiss, SIGGRAPH 2004)

slide-18
SLIDE 18

Editing & Manipulating Photos Editing & Manipulating Photos

Scissoring objects from a photo

es es composite image composite image source images source images

slide-19
SLIDE 19

Giving Photos a “Painted” Look Giving Photos a “Painted” Look

From P. Litwinowicz’s SIGGRAPH’97 paper “Processing Images and Videos for an Impressionist Effect”

slide-20
SLIDE 20

Topic 4: Topic 4: Local analysis of image Local analysis of image patches patches patches patches

  • What do we mean by an image “patch”?

What do we mean by an image “patch”?

  • Applications of local image analysis

Applications of local image analysis

  • Visualizing 1D and 2D

Visualizing 1D and 2D image patches as intensity image patches as intensity functions functions

slide-21
SLIDE 21

Visualizing An Image Visualizing An Image as a as a Surface in 3D Surface in 3D

Gray-scale image

A gray-scale image is like a function I(x,y)

slide-22
SLIDE 22

Image Image ⇔ Surface in 3D Surface in 3D

Gray-scale image Surface Surface

And we can visualize this function in 3D

slide-23
SLIDE 23

Image Image ⇔ Surface in 3D Surface in 3D

Gray-scale image Surface Surface Surface Surface

slide-24
SLIDE 24

Gray-scale image

Image Image ⇔ Surface in 3D Surface in 3D

Image patch Image patch

The same applies to image patches

slide-25
SLIDE 25

Gray-scale image

Image Image ⇔ Surface in 3D Surface in 3D

Image patch Image patch Surface patch Surface patch Patches have their

  • wn coordinate

system.

slide-26
SLIDE 26

BTW, notice image noise BTW, notice image noise

slide-27
SLIDE 27

Visualizing a Row or Column Visualizing a Row or Column as a as a Graph in 2D Graph in 2D

Gray-scale image Graph in 2D

Another way of visualizing image data is as a graph in 2D

slide-28
SLIDE 28

Image row or column Image row or column ⇔ Graph in 2D Graph in 2D

Gray-scale image Graph in 2D

And of course, we can do this for a 1D patch.

slide-29
SLIDE 29

Today we’ll learn about Today we’ll learn about

4.1. Today’s lecture is about modeling image data taking into account more than one (potentially noisy) single pixel. We will focus on 1D patches. Methods include: Computing derivatives of 1D patches using polynomial fitting via Least-squares, weighted least squares and fitting via Least-squares, weighted least squares and RANSAC

slide-30
SLIDE 30

where are we, and what will where are we, and what will come after? come after? come after? come after?

  • Subtopics:

Subtopics:

  • 1. Local analysis of 1D image patches (today)
  • 2. Local analysis of 2D curve patches
  • 3. Local analysis of 2D image patches
slide-31
SLIDE 31

Local Analysis of Image Patches: Outline Local Analysis of Image Patches: Outline

As graph in 2D As graph in 2D As curve in 2D As curve in 2D As surface in 3D As surface in 3D

slide-32
SLIDE 32

Topic 4: Topic 4: Local analysis of image Local analysis of image patches patches patches patches

  • Subtopics:

Subtopics:

  • 1. Local analysis of 1D image patches
  • 2. Local analysis of 2D curve patches
  • 3. Local analysis of 2D image patches
slide-33
SLIDE 33

Topic 4.1: Topic 4.1: Local analysis of 1D image Local analysis of 1D image patches patches patches patches

  • Taylor series approximation of 1D intensity patches

Taylor series approximation of 1D intensity patches

  • Estimating derivatives of 1D intensity patches

Least-squares fitting Weighted least-squares fitting Robust polynomial fitting: RANSAC

slide-34
SLIDE 34

Topic 4.1: Topic 4.1: Local analysis of 1D image Local analysis of 1D image patches patches patches patches

  • Taylor series approximation of 1D intensity patches

Taylor series approximation of 1D intensity patches

  • Estimating derivatives of 1D intensity patches:

Least-squares fitting Weighted least-squares fitting Robust polynomial fitting: RANSAC

slide-35
SLIDE 35

Least Least-

  • Squares Polynomial Fitting

Squares Polynomial Fitting

Taylor approximation: Fit a polynomial Taylor approximation: Fit a polynomial to to the pixel the pixel intensities in a patch intensities in a patch

  • All pixels contribute equally to estimate of

All pixels contribute equally to estimate of derivative(s) at patch center (i.e., at x=0) derivative(s) at patch center (i.e., at x=0)

Intensity Intensity Pixel (x) Pixel (x) w

  • w
slide-36
SLIDE 36

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x)

As graph in 2D As graph in 2D

If we knew the derivatives of I(x) at x=0, we can approximate I(x) using the Taylor Series:

slide-37
SLIDE 37

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x)

As graph in 2D As graph in 2D

If we knew the derivatives of I(x) at x=0, we can approximate I(x) using the Taylor Series:

?

slide-38
SLIDE 38

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x)

As graph in 2D As graph in 2D

If we knew the derivatives of I(x) at x=0, we can approximate I(x) using the Taylor Series: The approximation is best at the

  • rigin and degrades from there.
slide-39
SLIDE 39

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x)

As graph in 2D As graph in 2D

The n-th order Taylor series expansion of I(x), near the patch center (x=0) can then be written in matrix form as: Note that an approximated value for I(x) will depend on n+1 coefficients: the intensity derivatives at I(0)

slide-40
SLIDE 40

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x)

As graph in 2D As graph in 2D

Example: 0th order approximation

slide-41
SLIDE 41

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x)

As graph in 2D As graph in 2D

Example: 1st order approximation

slide-42
SLIDE 42

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x)

As graph in 2D As graph in 2D

Example: 2nd order approximation

slide-43
SLIDE 43

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x)

As graph in 2D As graph in 2D

And so on…

slide-44
SLIDE 44

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x) But do we know the derivatives? But do we know the derivatives?

slide-45
SLIDE 45

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x) But do we know the derivatives? But do we know the derivatives? No, but we can estimate them!

slide-46
SLIDE 46

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x) And can we estimate them for the entire row? And can we estimate them for the entire row?

slide-47
SLIDE 47

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x) And can we estimate them for the entire row? And can we estimate them for the entire row? Yes, but pixel by pixel. In fact…

slide-48
SLIDE 48

Applying the same operation on multiple patches Applying the same operation on multiple patches

A “sliding A “sliding window” window” algorithm is a algorithm is a common approach to patch common approach to patch-based based

  • perations
  • perations

The algorithm goes as follows: The algorithm goes as follows:

slide-49
SLIDE 49

A “sliding A “sliding window” window” algorithm is a algorithm is a common approach to patch common approach to patch-based based

  • perations
  • perations

The algorithm goes as follows: The algorithm goes as follows: 1. 1. Define a “pixel window” using a Define a “pixel window” using a window size and a window center. window size and a window center.

Applying the same operation on multiple patches Applying the same operation on multiple patches

slide-50
SLIDE 50

A “sliding A “sliding window” window” algorithm is a algorithm is a common approach to patch common approach to patch-based based

  • perations
  • perations

The algorithm goes as follows: The algorithm goes as follows: 1. 1. Define a “pixel window” using a Define a “pixel window” using a window size and a window center. window size and a window center. 2. 2. Apply whatever operation in mind Apply whatever operation in mind

Applying the same operation on multiple patches Applying the same operation on multiple patches

2. 2. Apply whatever operation in mind Apply whatever operation in mind to that patch to that patch 3. 3. Move the window center one pixel Move the window center one pixel to define a new window to define a new window 4. 4. Repeat steps 1 Repeat steps 1-3

slide-51
SLIDE 51

A “sliding A “sliding window” window” algorithm is a algorithm is a common approach to patch common approach to patch-based based

  • perations
  • perations

The algorithm goes as follows: The algorithm goes as follows: 1. 1. Define a “pixel window” using a Define a “pixel window” using a window size and a window center. window size and a window center. 2. 2. Apply whatever operation in mind Apply whatever operation in mind

Applying the same operation on multiple patches Applying the same operation on multiple patches

2. 2. Apply whatever operation in mind Apply whatever operation in mind to that patch to that patch 3. 3. Move the window center one pixel Move the window center one pixel to define a new window to define a new window 4. 4. Repeat steps 1 Repeat steps 1-3

slide-52
SLIDE 52

A “sliding A “sliding window” window” algorithm is a algorithm is a common approach to patch common approach to patch-based based

  • perations
  • perations

The algorithm goes as follows: The algorithm goes as follows: 1. 1. Define a “pixel window” using a Define a “pixel window” using a window size and a window center. window size and a window center. 2. 2. Apply whatever operation in mind Apply whatever operation in mind

Applying the same operation on multiple patches Applying the same operation on multiple patches

2. 2. Apply whatever operation in mind Apply whatever operation in mind to that patch to that patch 3. 3. Move the window center one pixel Move the window center one pixel to define a new window to define a new window 4. 4. Repeat steps 1 Repeat steps 1-3

slide-53
SLIDE 53

A “sliding A “sliding window” window” algorithm is a algorithm is a common approach to patch common approach to patch-based based

  • perations
  • perations

The algorithm goes as follows: The algorithm goes as follows: 1. 1. Define a “pixel window” using a Define a “pixel window” using a window size and a window center. window size and a window center. 2. 2. Apply whatever operation in mind Apply whatever operation in mind

Applying the same operation on multiple patches Applying the same operation on multiple patches

2. 2. Apply whatever operation in mind Apply whatever operation in mind to that patch to that patch 3. 3. Move the window center one pixel Move the window center one pixel to define a new window to define a new window 4. 4. Repeat steps 1 Repeat steps 1-3

slide-54
SLIDE 54

A “sliding A “sliding window” window” algorithm is a algorithm is a common approach to patch common approach to patch-based based

  • perations
  • perations

The algorithm goes as follows: The algorithm goes as follows: 1. 1. Define a “pixel window” using a Define a “pixel window” using a window size and a window center. window size and a window center. 2. 2. Apply whatever operation in mind Apply whatever operation in mind

Applying the same operation on multiple patches Applying the same operation on multiple patches

2. 2. Apply whatever operation in mind Apply whatever operation in mind to that patch to that patch 3. 3. Move the window center one pixel Move the window center one pixel to define a new window to define a new window 4. 4. Repeat steps 1 Repeat steps 1-3

slide-55
SLIDE 55

Estimating Derivatives For Image Row r Estimating Derivatives For Image Row r

“Sliding window” algorithm: “Sliding window” algorithm:

  • Define a “pixel window” centered

Define a “pixel window” centered at pixel ( at pixel (w,r w,r) )

  • Fit n

Fit n-degree poly to window’s degree poly to window’s intensities (usually n=1 or 2) intensities (usually n=1 or 2)

  • Assign the poly’s derivatives at x=0

Assign the poly’s derivatives at x=0 to pixel at window’s center to pixel at window’s center to pixel at window’s center to pixel at window’s center

  • “Slide” window one pixel over, so

“Slide” window one pixel over, so that it is centered at pixel (w+1,r) that it is centered at pixel (w+1,r)

  • Repeat 1

Repeat 1-4 until window reaches 4 until window reaches right image border right image border

slide-56
SLIDE 56

Estimating Derivatives For Image Row r Estimating Derivatives For Image Row r

“Sliding window” algorithm: “Sliding window” algorithm:

  • Define a “pixel window” centered

Define a “pixel window” centered at pixel ( at pixel (w,r w,r) )

  • Fit n

Fit n-degree poly to window’s degree poly to window’s intensities (usually n=1 or 2) intensities (usually n=1 or 2)

  • Assign the poly’s derivatives at x=0

Assign the poly’s derivatives at x=0 to pixel at window’s center to pixel at window’s center to pixel at window’s center to pixel at window’s center

  • “Slide” window one pixel over, so

“Slide” window one pixel over, so that it is centered at pixel (w+1,r) that it is centered at pixel (w+1,r)

  • Repeat 1

Repeat 1-4 until window reaches 4 until window reaches right image border right image border

slide-57
SLIDE 57

Estimating Derivatives For Image Row r Estimating Derivatives For Image Row r

“Sliding window” algorithm: “Sliding window” algorithm:

  • Define a “pixel window” centered

Define a “pixel window” centered at pixel ( at pixel (w,r w,r) )

  • Fit n

Fit n-degree poly to window’s degree poly to window’s intensities (usually n=1 or 2) intensities (usually n=1 or 2)

  • Assign the poly’s derivatives at x=0

Assign the poly’s derivatives at x=0 to pixel at window’s center to pixel at window’s center to pixel at window’s center to pixel at window’s center

  • “Slide” window one pixel over, so

“Slide” window one pixel over, so that it is centered at pixel (w+1,r) that it is centered at pixel (w+1,r)

  • Repeat 1

Repeat 1-4 until window reaches 4 until window reaches right image border right image border

slide-58
SLIDE 58

Estimating Derivatives For Image Row r Estimating Derivatives For Image Row r

“Sliding window” algorithm: “Sliding window” algorithm:

  • Define a “pixel window” centered

Define a “pixel window” centered at pixel ( at pixel (w,r w,r) )

  • Fit n

Fit n-degree poly to window’s degree poly to window’s intensities (usually n=1 or 2) intensities (usually n=1 or 2)

  • Assign the poly’s derivatives at x=0

Assign the poly’s derivatives at x=0 to pixel at window’s center to pixel at window’s center to pixel at window’s center to pixel at window’s center

  • “Slide” window one pixel over, so

“Slide” window one pixel over, so that it is centered at pixel (w+1,r) that it is centered at pixel (w+1,r)

  • Repeat 1

Repeat 1-4 until window reaches 4 until window reaches right image border right image border

slide-59
SLIDE 59

Estimating Derivatives For Image Row r Estimating Derivatives For Image Row r

“Sliding window” algorithm: “Sliding window” algorithm:

  • Define a “pixel window” centered

Define a “pixel window” centered at pixel ( at pixel (w,r w,r) )

  • Fit n

Fit n-degree poly to window’s degree poly to window’s intensities (usually n=1 or 2) intensities (usually n=1 or 2)

  • Assign the poly’s derivatives at x=0

Assign the poly’s derivatives at x=0 to pixel at window’s center to pixel at window’s center to pixel at window’s center to pixel at window’s center

  • “Slide” window one pixel over, so

“Slide” window one pixel over, so that it is centered at pixel (w+1,r) that it is centered at pixel (w+1,r)

  • Repeat 1

Repeat 1-4 until window reaches 4 until window reaches right image border right image border

slide-60
SLIDE 60

Estimating Derivatives For Image Row r Estimating Derivatives For Image Row r

“Sliding window” algorithm: “Sliding window” algorithm:

  • Define a “pixel window” centered

Define a “pixel window” centered at pixel ( at pixel (w,r w,r) )

  • Fit n

Fit n-degree poly to window’s degree poly to window’s intensities (usually n=1 or 2) intensities (usually n=1 or 2)

  • Assign the poly’s derivatives at x=0

Assign the poly’s derivatives at x=0 to pixel at window’s center to pixel at window’s center to pixel at window’s center to pixel at window’s center

  • “Slide” window one pixel over, so

“Slide” window one pixel over, so that it is centered at pixel (w+1,r) that it is centered at pixel (w+1,r)

  • Repeat 1

Repeat 1-4 until window reaches 4 until window reaches right image border right image border

slide-61
SLIDE 61

Topic 4.1: Topic 4.1: Local analysis of 1D image Local analysis of 1D image patches patches patches patches

  • Taylor series approximation of 1D intensity patches

Taylor series approximation of 1D intensity patches

  • Estimating derivatives of 1D intensity patches:

Estimating derivatives of 1D intensity patches:

  • Least

Least-

  • squares fitting

squares fitting

  • Weighted least-squares fitting
  • Robust polynomial fitting: RANSAC
slide-62
SLIDE 62

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x)

As graph in 2D As graph in 2D

How to estimate the Taylor series approximation from image data? image data?

slide-63
SLIDE 63

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x)

As graph in 2D As graph in 2D

Surprise! The nth degree Taylor approximation can be approximation can be estimated using a linear system of equations (which we can represent in matrix form). This is Least Squares!

slide-64
SLIDE 64

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x)

As graph in 2D As graph in 2D

We know that the Taylor series is:

slide-65
SLIDE 65

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x)

As graph in 2D As graph in 2D

We know that the Taylor series is: The derivatives are unknown

slide-66
SLIDE 66

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x)

As graph in 2D As graph in 2D

We know that the Taylor series is: But the coefficients are known

slide-67
SLIDE 67

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x)

As graph in 2D As graph in 2D

The n-th order Taylor series expansion of I(x), near the patch center (x=0) can then be written in matrix form as:

slide-68
SLIDE 68

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x)

As graph in 2D As graph in 2D

The n-th order Taylor series expansion of I(x), near the patch center (x=0) can then be written in matrix form as:

slide-69
SLIDE 69

Taylor Taylor-

  • Series Approximation of I(x)

Series Approximation of I(x)

As graph in 2D As graph in 2D

The n-th order Taylor series expansion of I(x), near the patch center (x=0) can then be written in matrix form as: 2w+1 equations to estimate n+1 unknowns

slide-70
SLIDE 70

As graph in 2D As graph in 2D

Least Least-

  • Squares Polynomial Fitting of I(x)

Squares Polynomial Fitting of I(x)

The equations define the system:

slide-71
SLIDE 71

Least Least-

  • Squares Polynomial Fitting of I(x)

Squares Polynomial Fitting of I(x)

We could then do v=Xd to get an estimate for all pixels in the patch in (-w, …, 0, …, w)

slide-72
SLIDE 72

Least Least-

  • Squares Polynomial Fitting of I(x)

Squares Polynomial Fitting of I(x)

slide-73
SLIDE 73

0th

th-

  • Order (Constant) Estimation of I(x)

Order (Constant) Estimation of I(x)

slide-74
SLIDE 74

0th

th-

  • Order (Constant) Estimation of I(x)

Order (Constant) Estimation of I(x)

slide-75
SLIDE 75

0th

th-

  • Order (Constant) Estimation of I(x)

Order (Constant) Estimation of I(x)

slide-76
SLIDE 76

0th

th-

  • Order (Constant) Estimation of I(x)

Order (Constant) Estimation of I(x)

slide-77
SLIDE 77

0th

th-

  • Order (Constant) Estimation of I(x)

Order (Constant) Estimation of I(x)

slide-78
SLIDE 78

0th

th-

  • Order (Constant) Estimation of I(x)

Order (Constant) Estimation of I(x)

slide-79
SLIDE 79

1st

st-

  • Order (Linear) Estimation of I(x)

Order (Linear) Estimation of I(x)

slide-80
SLIDE 80

2nd

nd-

  • Order (Quadratic) Estimation of I(x)

Order (Quadratic) Estimation of I(x)

slide-81
SLIDE 81

2nd

nd-

  • Order (Quadratic) Estimation of I(x)

Order (Quadratic) Estimation of I(x)

Note how all pixels in the window contribute equally to the estimate around the center of the window!

slide-82
SLIDE 82

Topic 4.1: Topic 4.1: Local analysis of 1D image Local analysis of 1D image patches patches patches patches

  • Taylor series approximation of 1D intensity patches

Taylor series approximation of 1D intensity patches

  • Estimating derivatives of 1D intensity patches:

Estimating derivatives of 1D intensity patches:

  • Least-squares fitting
  • Weighted least

Weighted least-

  • squares fitting

squares fitting

  • Robust polynomial fitting: RANSAC
slide-83
SLIDE 83

Weighted Least Squares Polynomial Fitting Weighted Least Squares Polynomial Fitting

Scenario #1: Scenario #1:

  • Fit polynomial to ALL pixel intensities in a patch

Fit polynomial to ALL pixel intensities in a patch

Intensity Intensity Pixel (x) Pixel (x) w

  • w
slide-84
SLIDE 84

Weighted Least Squares Polynomial Fitting Weighted Least Squares Polynomial Fitting

Scenario #2: Scenario #2:

  • Fit polynomial to

Fit polynomial to all the pixel all the pixel intensities in intensities in the the patch patch

  • Pixels contribute to estimate of derivative(s) at

Pixels contribute to estimate of derivative(s) at center according to a weight function center according to a weight function Ω(x) (x)

Intensity Intensity Pixel (x) Pixel (x) w

  • w
slide-85
SLIDE 85

Polynomial Fitting: A Linear Formulation Polynomial Fitting: A Linear Formulation

slide-86
SLIDE 86

Polynomial Fitting: A Linear Formulation Polynomial Fitting: A Linear Formulation

slide-87
SLIDE 87

Weighted Least Weighted Least-

  • Squares Estimation of I(x)

Squares Estimation of I(x)

slide-88
SLIDE 88

Weighted Least Weighted Least-

  • Squares Estimation of I(x)

Squares Estimation of I(x)

slide-89
SLIDE 89

Weighted Least Weighted Least-

  • Squares Estimation of I(x)

Squares Estimation of I(x)

slide-90
SLIDE 90

Weighted Least Weighted Least-

  • Squares Estimation of I(x)

Squares Estimation of I(x)

We could then do v=Xd to get We could then do v=Xd to get an estimate of I(x) for all pixels in the patch in (-w, …, 0, …, w).

slide-91
SLIDE 91

Topic 4.1: Topic 4.1: Local analysis of 1D image Local analysis of 1D image patches patches patches patches

  • Taylor series approximation of 1D intensity patches

Taylor series approximation of 1D intensity patches

  • Estimating derivatives of 1D intensity patches:

Estimating derivatives of 1D intensity patches:

  • Least-squares fitting
  • Weighted least-squares fitting
  • Robust polynomial fitting: RANSAC

Robust polynomial fitting: RANSAC

slide-92
SLIDE 92

Robust Polynomial Fitting Robust Polynomial Fitting

Scenario #3: Scenario #3:

  • Fit polynomial only to SOME pixel intensities in a patch

Fit polynomial only to SOME pixel intensities in a patch (the “inliers”) (the “inliers”)

Intensity Intensity Pixel (x) Pixel (x) w

  • w
slide-93
SLIDE 93

Robust Polynomial Fitting Robust Polynomial Fitting

But how can we tell between inliers and outliers? But how can we tell between inliers and outliers?

Intensity Intensity Pixel (x) Pixel (x) w

  • w
slide-94
SLIDE 94

Robust Polynomial Fitting Robust Polynomial Fitting

We can’t. At least not before we fit a model. We can’t. At least not before we fit a model.

slide-95
SLIDE 95

Polynomial Fitting Using RANSAC Polynomial Fitting Using RANSAC

Here’s our problem: find the inliers, fit a polynomial to them: Here’s our problem: find the inliers, fit a polynomial to them:

Intensity Intensity Given: Given:

  • n = degree of poly

n = degree of poly

  • p = fraction of inliers

p = fraction of inliers

  • t = fit threshold

t = fit threshold

  • p = success probability

= success probability Pixel (x) Pixel (x)

  • ps = success probability

= success probability w

  • w
slide-96
SLIDE 96

RANSAC Algorithm RANSAC Algorithm

Example: Line fitting using RANSAC (i.e., n=2 unknown Example: Line fitting using RANSAC (i.e., n=2 unknown polynomial coefficients) polynomial coefficients)

  • Step 1: Randomly choose n pixels from the patch

Step 1: Randomly choose n pixels from the patch

Intensity Intensity Pixel (x) Pixel (x) w

  • w
slide-97
SLIDE 97

RANSAC Algorithm RANSAC Algorithm

Step Step 2: Fit the poly using the chosen pixels/intensities 2: Fit the poly using the chosen pixels/intensities

Intensity Intensity Pixel (x) Pixel (x) w

  • w
slide-98
SLIDE 98

RANSAC Algorithm RANSAC Algorithm

Step Step 3: Count pixels with vertical distance < threshold t 3: Count pixels with vertical distance < threshold t

Pixel (x) Pixel (x) w

  • w
slide-99
SLIDE 99

RANSAC Algorithm RANSAC Algorithm

  • Step 4: If there aren’t “enough” such pixels, REPEAT

Step 4: If there aren’t “enough” such pixels, REPEAT (not more than K times) (not more than K times)

Pixel (x) Pixel (x) w

  • w
slide-100
SLIDE 100

RANSAC Algorithm RANSAC Algorithm

How about these two? How about these two?

Intensity Intensity Pixel (x) Pixel (x) w

  • w
slide-101
SLIDE 101

RANSAC Algorithm RANSAC Algorithm

Step Step 4: If there are “enough” such pixels, STOP 4: If there are “enough” such pixels, STOP Label them as “inliers” & do a least Label them as “inliers” & do a least-squares fit squares fit to the INLIER pixels only to the INLIER pixels only

Intensity Intensity Pixel (x) Pixel (x) w

  • w
slide-102
SLIDE 102

RANSAC Algorithm RANSAC Algorithm

Step Step 4: If there are “enough” such pixels, STOP 4: If there are “enough” such pixels, STOP Label them as “inliers” & do a least Label them as “inliers” & do a least-squares fit squares fit to the INLIER pixels only to the INLIER pixels only

Intensity Intensity Pixel (x) Pixel (x) w

  • w
slide-103
SLIDE 103

RANSAC Algorithm RANSAC Algorithm

Eventually Eventually, after “enough” trials, , after “enough” trials, there must be some there must be some likelihood of having chosen n+1 inliers likelihood of having chosen n+1 inliers to fit the model. to fit the model.

Intensity Intensity Pixel (x) Pixel (x) w

  • w
slide-104
SLIDE 104

RANSAC Algorithm RANSAC Algorithm

Eventually Eventually, after “enough” trials, , after “enough” trials, there must be some there must be some likelihood of having chosen n+1 inliers likelihood of having chosen n+1 inliers to fit the model. to fit the model. How many trials are enough then? How many trials are enough then?

slide-105
SLIDE 105

RANSAC Algorithm RANSAC Algorithm

Repeat at most K times: Repeat at most K times: 1.

  • 1. Randomly choose n+1 pixels

Randomly choose n+1 pixels Given: Given:

  • n = degree of poly

n = degree of poly

  • p = fraction of inliers

p = fraction of inliers

  • t = fit threshold

t = fit threshold

  • ps = success probability

= success probability 1.

  • 1. Randomly choose n+1 pixels

Randomly choose n+1 pixels 2.

  • 2. Fit n

Fit n-degree poly degree poly 3.

  • 3. Count pixels whose vertical

Count pixels whose vertical distance from poly is < t distance from poly is < t 4.

  • 4. If there are at least

If there are at least (2w+1)p pixels, EXIT LOOP (2w+1)p pixels, EXIT LOOP

  • a. Label them as inliers
  • a. Label them as inliers
  • b. Fit n
  • b. Fit n-degree poly to all

degree poly to all inlier inlier pixels pixels

slide-106
SLIDE 106

RANSAC Algorithm RANSAC Algorithm

Repeat at most K times: Repeat at most K times: 1.

  • 1. Randomly choose n+1 pixels

Randomly choose n+1 pixels Given: Given:

  • n = degree of poly

n = degree of poly

  • p = fraction of inliers

p = fraction of inliers

  • t = fit threshold

t = fit threshold

  • ps = success probability

= success probability 1.

  • 1. Randomly choose n+1 pixels

Randomly choose n+1 pixels 2.

  • 2. Fit n

Fit n-degree poly degree poly 3.

  • 3. Count pixels whose vertical

Count pixels whose vertical distance from poly is < t distance from poly is < t 4.

  • 4. If there are at least

If there are at least (2w+1)p pixels, EXIT LOOP (2w+1)p pixels, EXIT LOOP

  • a. Label them as inliers
  • a. Label them as inliers
  • b. Fit n
  • b. Fit n-degree poly to all

degree poly to all inlier pixels inlier pixels