Download presentation

Presentation is loading. Please wait.

Published byRamiro Grigson Modified over 2 years ago

1
CSCE 643 Computer Vision: Lucas-Kanade Registration Jinxiang Chai

2
Appearance-based Tracking Slide from Robert Collins

3
Image Registration This requires solving image registration problems Lucas-Kanade is one of the most popular frameworks for image registration - gradient based optimization - iterative linear system solvers - applicable to a variety of scenarios, including optical flow estimation, parametric motion tracking, AAMs, etc.

4
Pixel-based Registration: Optical flow Will start by estimating motion of each pixel separately Then will consider motion of entire image

5
Problem Definition: Optical FlowOptical Flow How to estimate pixel motion from image H to image I?

6
Problem Definition: Optical FlowOptical Flow How to estimate pixel motion from image H to image I? –Solve pixel correspondence problem given a pixel in H, look for nearby pixels of the same color in I

7
Problem Definition: Optical FlowOptical Flow How to estimate pixel motion from image H to image I? –Solve pixel correspondence problem given a pixel in H, look for nearby pixels of the same color in I Key assumptions –color constancy: a point in H looks the same in I For grayscale images, this is brightness constancy –small motion: points do not move very far This is called the optical flow problem

8
Optical Flow Constraints Let’s look at these constraints more closely –brightness constancy: Q: what’s the equation?

9
Optical Flow Constraints Let’s look at these constraints more closely –brightness constancy: Q: what’s the equation? H(x,y) - I(x+u,v+y) = 0

10
Optical Flow Constraints Let’s look at these constraints more closely –brightness constancy: Q: what’s the equation? –small motion: (u and v are less than 1 pixel) suppose we take the Taylor series expansion of I: H(x,y) - I(x+u,v+y) = 0

11
Optical Flow Constraints Let’s look at these constraints more closely –brightness constancy: Q: what’s the equation? –small motion: (u and v are less than 1 pixel) suppose we take the Taylor series expansion of I: H(x,y) - I(x+u,v+y) = 0

12
Optical Flow Equation Combining these two equations

13
Optical Flow Equation Combining these two equations

14
Optical Flow Equation Combining these two equations

15
Optical Flow Equation Combining these two equations

16
Optical Flow Equation Combining these two equations In the limit as u and v go to zero, this becomes exact

17
Optical Flow Equation How many unknowns and equations per pixel?

18
Optical Flow Equation How many unknowns and equations per pixel? Intuitively, what does this constraint mean?

19
Optical Flow Equation How many unknowns and equations per pixel? Intuitively, what does this constraint mean? –The component of the flow in the gradient direction is determined –The component of the flow parallel to an edge is unknown

20
Optical Flow Equation How many unknowns and equations per pixel? Intuitively, what does this constraint mean? –The component of the flow in the gradient direction is determined –The component of the flow parallel to an edge is unknown

21
Ambiguity

22
Stripes moved upwards 6 pixels Stripes moved left 5 pixels

23
Ambiguity Stripes moved upwards 6 pixels Stripes moved left 5 pixels How to address this problem?

24
Solving the Aperture Problem How to get more equations for a pixel? –Basic idea: impose additional constraints most common is to assume that the flow field is smooth locally one method: pretend the pixel’s neighbors have the same (u,v) –If we use a 5x5 window, that gives us 25 equations per pixel!

25
RGB Version How to get more equations for a pixel? –Basic idea: impose additional constraints most common is to assume that the flow field is smooth locally one method: pretend the pixel’s neighbors have the same (u,v) –If we use a 5x5 window, that gives us 25 equations per pixel!

26
Lukas-Kanade Flow Prob: we have more equations than unknowns

27
Lukas-Kanade Flow Prob: we have more equations than unknowns Solution: solve least squares problem

28
Lukas-Kanade Flow Prob: we have more equations than unknowns Solution: solve least squares problem –minimum least squares solution given by solution (in d) of:

29
Lukas-Kanade Flow –The summations are over all pixels in the K x K window –This technique was first proposed by Lukas & Kanade (1981)

30
Lukas-Kanade Flow When is this Solvable? A T A should be invertible A T A should not be too small due to noise –eigenvalues 1 and 2 of A T A should not be too small A T A should be well-conditioned – 1 / 2 should not be too large ( 1 = larger eigenvalue)

31
Lukas-Kanade Flow When is this Solvable? A T A should be invertible A T A should not be too small due to noise –eigenvalues 1 and 2 of A T A should not be too small A T A should be well-conditioned – 1 / 2 should not be too large ( 1 = larger eigenvalue) Look familiar?

32
Lukas-Kanade Flow When is this Solvable? A T A should be invertible A T A should not be too small due to noise –eigenvalues 1 and 2 of A T A should not be too small A T A should be well-conditioned – 1 / 2 should not be too large ( 1 = larger eigenvalue) Look familiar? Harris Corner detection criterion!

33
Edge Bad for motion estimation - large 1, small 2

34
Low Texture Region Bad for motion estimation: - gradients have small magnitude - small 1, small 2

35
High Textured Region Good for motion estimation: - gradients are different, large magnitudes - large 1, large 2

36
Good Features to Track This is a two image problem BUT –Can measure sensitivity by just looking at one of the images! –This tells us which pixels are easy to track, which are hard very useful later on when we do feature tracking... For more detail, check “Good feature to Track”, Shi and Tomasi, CVPR 1994Good feature to Track

37
Errors in Lucas-Kanade What are the potential causes of errors in this procedure? –Suppose A T A is easily invertible –Suppose there is not much noise in the image

38
Errors in Lucas-Kanade What are the potential causes of errors in this procedure? –Suppose A T A is easily invertible –Suppose there is not much noise in the image When our assumptions are violated –Brightness constancy is not satisfied –The motion is not small –A point does not move like its neighbors Optical flow in local window is not constant.

39
Errors in Lucas-Kanade What are the potential causes of errors in this procedure? –Suppose A T A is easily invertible –Suppose there is not much noise in the image When our assumptions are violated –Brightness constancy is not satisfied –The motion is not small –A point does not move like its neighbors Optical flow in local window is not constant.

40
Revisiting the Small Motion Assumption Is this motion small enough? –Probably not—it’s much larger than one pixel (2 nd order terms dominate) –How might we solve this problem?

41
Iterative Refinement Iterative Lukas-Kanade Algorithm 1.Estimate velocity at each pixel by solving Lucas- Kanade equations 2.Warp H towards I using the estimated flow field - use image warping techniques 3.Repeat until convergence

42
Idea I: Iterative Refinement Iterative Lukas-Kanade Algorithm 1.Estimate velocity at each pixel by solving Lucas- Kanade equations 2.Warp H towards I using the estimated flow field - use image warping techniques 3.Repeat until convergence

43
Idea II: Reduce the Resolution!

44
image I image H Gaussian pyramid of image HGaussian pyramid of image I image I image H u=10 pixels u=5 pixels u=2.5 pixels u=1.25 pixels Coarse-to-fine Motion Estimation

45
image I image J Gaussian pyramid of image HGaussian pyramid of image I image I image H Coarse-to-fine Optical Flow Estimation run iterative L-K Upsample & warp......

46
Errors in Lucas-Kanade What are the potential causes of errors in this procedure? –Suppose A T A is easily invertible –Suppose there is not much noise in the image When our assumptions are violated –Brightness constancy is not satisfied –The motion is not small –A point does not move like its neighbors Optical flow in local window is not constant.

47
Lucas Kanade Tracking Assumption of constant flow (pure translation) for all pixels in a larger window might be unreasonable

48
Lucas Kanade Tracking Assumption of constant flow (pure translation) for all pixels in a larger window might be unreasonable However, we can easily generalize Lucas- Kanade approach to other 2D parametric motion models (like affine or projective)

49
Beyond Translation So far, our patch can only translate in (u,v) What about other motion models? –rotation, affine, perspective

50
Warping Review Figure from Szeliski book

51
Geometric Image Warping w(x;p) describes the geometric relationship between two images: Transformed ImageInput Image x’x

52
Geometric Image Warping w(x;p) describes the geometric relationship between two images: Transformed ImageInput Image (x’) (x) Warping parameters

53
Warping Functions Translation: Affine: Perspective:

54
Image Registration Find the warping parameter p that minimizes the intensity difference between template image and the warped input image

55
Image Registration Find the warping parameter p that minimizes the intensity difference between template image and the warped input image Again, we can formulate this as an optimization problem:

56
Image Registration Find the warping parameter p that minimizes the intensity difference between template image and the warped input image Again, we can formulate this as an optimization problem: The above problem can be solved by many gradient-based optimization algorithms: - Steepest descentSteepest descent - Gauss-newtonGauss-newton - Levenberg-marquardt, etc. Levenberg-marquardt

57
Image Registration Find the warping parameter p that minimizes the intensity difference between template image and the warped input image Again, we can formulate this as an optimization problem: The above problem can be solved by many gradient-based optimization algorithms: - Steepest descent - Gauss-newton - Levenberg-marquardt, etc

58
Image Registration Mathematically, we can formulate this as an optimization problem:

59
Image Registration Mathematically, we can formulate this as an optimization problem: Taylor series expansion Similar to optical flow:

60
Image Registration Mathematically, we can formulate this as an optimization problem: Taylor series expansion Similar to optical flow:

61
Image Registration Mathematically, we can formulate this as an optimization problem: Taylor series expansion Image gradient Similar to optical flow:

62
Image Registration Mathematically, we can formulate this as an optimization problem: Taylor series expansion Image gradient translation affine …… Similar to optical flow: Jacobian matrix

63
Image Registration Mathematically, we can formulate this as an optimization problem: Taylor series expansion - Intuition? Similar to optical flow:

64
Image Registration Mathematically, we can formulate this as an optimization problem: Taylor series expansion - Intuition: a delta change of p results in how much change of pixel values at pixel w(x;p)! Similar to optical flow:

65
Image Registration Mathematically, we can formulate this as an optimization problem: Taylor series expansion - Intuition: a delta change of p results in how much change of pixel values at pixel w(x;p)! - An optimal that minimizes color inconsistency between the images. Similar to optical flow:

66
Gauss-newton Optimization Rearrange

67
Gauss-newton Optimization Rearrange

68
Gauss-newton Optimization Rearrange Ab

69
Gauss-newton Optimization Rearrange A ATbATb b (A T A) -1

70
Lucas-Kanade Registration Initialize p=p 0 : Iterate: 1. Warp I with w(x;p) to compute I(w(x;p))

71
Lucas-Kanade Registration Initialize p=p 0 : Iterate: 1. Warp I with w(x;p) to compute I(w(x;p)) 2. Compute the error image

72
Lucas-Kanade Registration Initialize p=p 0 : Iterate: 1. Warp I with w(x;p) to compute I(w(x;p)) 2. Compute the error image 3. Warp the gradient with w(x;p)

73
Lucas-Kanade Registration Initialize p=p 0 : Iterate: 1. Warp I with w(x;p) to compute I(w(x;p)) 2. Compute the error image 3. Warp the gradient with w(x;p) 4. Evaluate the Jacobian at (x;p)

74
Lucas-Kanade Registration Initialize p=p 0 : Iterate: 1. Warp I with w(x;p) to compute I(w(x;p)) 2. Compute the error image 3. Warp the gradient with w(x;p) 4. Evaluate the Jacobian at (x;p) 5. Compute the using linear system solvers

75
Lucas-Kanade Registration Initialize p=p 0 : Iterate: 1. Warp I with w(x;p) to compute I(w(x;p)) 2. Compute the error image 3. Warp the gradient with w(x;p) 4. Evaluate the Jacobian at (x;p) 5. Compute the using linear system solvers 6. Update the parameters

76
Lucas-Kanade Algorithm Iteration 1: H(x ) I(w(x;p)) H(x)-I(w(x;p))

77
Lucas-Kanade Algorithm Iteration 2: H(x ) I(w(x;p)) H(x)-I(w(x;p))

78
Lucas-Kanade Algorithm Iteration 3: H(x ) I(w(x;p)) H(x)-I(w(x;p))

79
Lucas-Kanade Algorithm Iteration 4: H(x ) I(w(x;p)) H(x)-I(w(x;p))

80
Lucas-Kanade Algorithm Iteration 5: H(x ) I(w(x;p)) H(x)-I(w(x;p))

81
Lucas-Kanade Algorithm Iteration 6: H(x ) I(w(x;p)) H(x)-I(w(x;p))

82
Lucas-Kanade Algorithm Iteration 7: H(x ) I(w(x;p)) H(x)-I(w(x;p))

83
Lucas-Kanade Algorithm Iteration 8: H(x ) I(w(x;p)) H(x)-I(w(x;p))

84
Lucas-Kanade Algorithm Iteration 9: H(x ) I(w(x;p)) H(x)-I(w(x;p))

85
Lucas-Kanade Algorithm Final result: H(x ) I(w(x;p)) H(x)-I(w(x;p))

86
How to Break Assumptions Small motion Constant optical flow in the window Color constancy

87
Break the Color Constancy How to deal with illumination change?

88
Break the Color Constancy How to deal with illumination change? Issue: corresponding pixels do not have consistent values due to illumination changes?

89
Break the Color Constancy How to deal with illumination change? - linear models - can model gain and bias (H 1 =H 0, H 2 = const., other zeros)

90
Linear Model Can also model the appearance of a face under different illumination using a linear combination of base images (PCA): - recording images under different illumination - applying PCA to recorded images to model illumination in recorded images - Images under unknown illuminations can be represented as a weighted combination of precomputed illumination image templates

91
Linear Model Can also model the appearance of a face under different illumination using a linear combination of base images (PCA): - recording images under different illumination - applying PCA to recorded images to model illumination in recorded images - Images under unknown illuminations can be represented as a weighted combination of precomputed illumination image templates MeanEigen vectors

92
Linear Model Can also model the appearance of a face under different illumination using a linear combination of base images (PCA): - recording images under different illumination - applying PCA to recorded images to model illumination in recorded images - Images under unknown illuminations can be represented as a weighted combination of precomputed illumination image template MeanEigen vectors Unknown weights/parameters

93
Linear Model Can also model the appearance of a face under different illumination using a linear combination of base images (PCA): mean face lighting variation

94
Image Registration Similarly, we can formulate this as an optimization problem:

95
Image Registration Similarly, we can formulate this as an optimization problem: Geometric warpingIllumination variations

96
Image Registration Similarly, we can formulate this as an optimization problem: For iterative registration, we have

97
Image Registration Similarly, we can formulate this as an optimization problem: Taylor series expansion For iterative registration, we have

98
Gauss-newton optimization

99

100
letsimilarly

101
Gauss-newton optimization letsimilarly

102
Gauss-newton optimization letsimilarly Jacobian matrixError image

103
Gauss-newton optimization letsimilarly Jacobian matrixError image Update equation:

104
Results with Illumination Changes [Hagar and Belhumeur 98]

105
Applications: 2D Face Registration Face registration using active appearance models

106
AAM for Image registration Goal: automatic detection of facial features from a single image

107
AAM for Image registration Goal: automatic detection of facial features from a single image Solution: register input image against a template constructed from a prerecorded facial image database

108
AAM: database construction Construct a database of images (e.g., faces) with variations

109
AAM: Feature Labeling Label all database images by identifying key facial features

110
AAM: Feature Labeling Label all database images by identifying key facial features So how to build a template based on labeled database images?

111
Key idea Decouple image variation into shape variation and appearance variation Model each of them using PCA A combined model consists of a linear shape model and a linear appearance model

112
Shape Variation

113
Shape Variation modeling A linear shape model consists of a triangle base face mesh s 0 plus a linear combination of shape vectors, s 1,…,s n

114
Shape Variation modeling A linear shape model consists of a triangle base face mesh s 0 plus a linear combination of shape vectors, s 1,…,s n A long vector stacking positions of vertices

115
Shape Variation modeling A linear shape model consists of a triangle base face mesh s 0 plus a linear combination of shape vectors, s 1,…,s n Mean shape

116
Shape Variation modeling A linear shape model consists of a triangle base face mesh s 0 plus a linear combination of shape vectors, s 1,…,s n Eigen vectors

117
Shape Variation modeling A linear shape model consists of a triangle base face mesh s 0 plus a linear combination of shape vectors, s 1,…,s n Shape parameter

118
Appearance Variation modeling A linear appearance model consists of a base appearance image A0 defined on the pixels inside the base mesh s 0 plus a linear combination of m appearance images A i also defined on the same set of pixels.

119
Appearance Variation modeling A linear appearance model consists of a base appearance image A0 defined on the pixels inside the base mesh s 0 plus a linear combination of m appearance images A i also defined on the same set of pixels. Defined in base mesh (mean shape)!

120
Model Instantiations A new image can be generated via AAM

121
Image Registration with AAM Analysis by synthesis: estimate the optimal parameters by minimizing the difference between input image and synthesized image - 2 min p Input imageSynthesized image

122
Image Registration with AAM Analysis by synthesis: estimate the optimal parameters by minimizing the difference between input image and synthesized image Solve the problem with iterative linear system solvers - for details, check “active appearance model revisited”, Iain Matthews and Simon Baker, IJCV 2004active appearance model revisitedIain MatthewsSimon Baker - 2 min p Input imageSynthesized image

123
Iterative Approach

124
Pros and Cons of AAM Registration It can register facial images from different peoples, different facial expressions and different illuminations The quality of results heavily depends on training datasets Gradient-based optimization is prone to local minima It often fails when face is under extreme deformation, pose, or illumination Needs to figure out a better way to measure the distance between input image and template image (e.g., gradients and edges)

125
Lucas-Kanade for Image Alignment Pros: –All pixels get used in matching –Can get sub-pixel accuracy (important for good mosaicing!) –Relatively fast and simple –Applicable to optical flow estimation, parametric motion tracking, and AAM registration Cons: –Prone to local minima –Relative small movement

126
Beyond 2D Tracking/Registration So far, we focus on registration between 2D images The same idea can be used in registration between 3D and 2D (model-based tracking) We will go back to this when we talk about model- based 3D tracking (e.g., head, human body and hand gesture)

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google