Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCE 641 Computer Graphics: Image Registration Jinxiang Chai.

Similar presentations


Presentation on theme: "CSCE 641 Computer Graphics: Image Registration Jinxiang Chai."— Presentation transcript:

1 CSCE 641 Computer Graphics: Image Registration Jinxiang Chai

2 Review Image warping Image registration

3 Image Warping Warping function - similarity, affine, projective etc Image warping - forward warping and two-pass 1D warping - backward warping Resampling filter - point sampling - bilinear filter - anisotropic filter x y u v S(x,y) T(u,v) forward Inverse

4 Image Registration Image warping: given h and f, compute g g(x) = f(h(x)) h f g? Image registration: given f and g, compute h h? f g

5 Outline Image registration - feature-based approach - pixel-based approach

6 Feature-based Alignment 1.Find a few important features (aka Interest Points) 2.Match them across two images 3.Compute image transformation function h

7 RANSAC

8 Feature-based Registration Works for small or large motion Model the motion within a patch or whole image using a parametric transformation model

9 Feature-based Registration Works for small or large motion Model the motion within a patch or whole image using a parametric transformation model How to deal with motions that cannot be described by a small number of parameters?

10 Outline Image registration - feature-based approach - pixel-based approach

11 Direct (pixel-based) Alignment: Optical flow Will start by estimating motion of each pixel separately Then will consider motion of entire image

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

13 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

14 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

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

16 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

17 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

18 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

19 Optical Flow Equation Combining these two equations

20 Optical Flow Equation Combining these two equations

21 Optical Flow Equation Combining these two equations

22 Optical Flow Equation Combining these two equations

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

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

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

26 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

27 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

28 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 A B Can we determine the flow at point A, B and C? C

29 Aperture Problem

30 Stripes moved upwards 6 pixels Stripes moved left 5 pixels

31 Aperture Problem Stripes moved upwards 6 pixels Stripes moved left 5 pixels How to address this problem?

32 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!

33 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!

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

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

36 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:

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

38 Lukas-Kanade Flow –The summations are over all pixels in the K x K window –This technique was first proposed by Lukas & Kanade (1981) A B C We now can solve this problem!

39 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)

40 Edge Bad for motion estimation - large  1, small 2

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

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

43 Observation 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...

44 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

45 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.

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 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?

48 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

49 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

50 Idea II: Reduce the Resolution!

51 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 Optical Flow Estimation

52 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......

53 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.

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

55 Warping Function w(x;p) describes the geometric relationship between two images: Template Image H(x)Input Image I(x) x

56 Warping Functions Translation: Affine: Perspective:

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

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

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

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

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

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

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

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

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

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

67 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 delta p should minimize color inconsistency between the images. Similar to optical flow:

68 Gauss-newton Optimization Rearrange

69 Gauss-newton Optimization Rearrange

70 Gauss-newton Optimization Rearrange Ab

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

72 Lucas-Kanade Registration Initialize p=p 0 : Iterate: 1. Warp I with w(x;p) to compute I(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

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)

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)

76 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

77 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 6. Update the parameters

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

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

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

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

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

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

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

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

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

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

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

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): mean face lighting variation

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

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

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

94 Gauss-newton optimization

95

96 letsimilarly

97 Gauss-newton optimization letsimilarly

98 Gauss-newton optimization letsimilarly Jacobian matrixError image

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

100 Results with Illumination Changes [Hagar and Belhumeur 98]

101 Applications: Image Alignment Image mosaicing

102 Applications: Video Stabilization

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

104 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 Cons: –Prone to local minima –Relative small movement

105 Beyond 2D Registration So far, we focus on registration between 2D images The same idea can be used in registration between 3D and 2D, and between 3D and 3D

106 3D-to-2D Registration The transformation between 3D object and 2D images

107 3D-to-2D Registration From world coordinate to image coordinate u0u0 v0v0 100 -s y 0 sxsx 0u v 1 Perspective projection View transformation Viewport projection

108 3D-to-2D Registration From world coordinate to image coordinate u0u0 v0v0 100 -s y 0 sxsx 0u v 1 Perspective projection View transformation Viewport projection Camera parameters3D points 2D projections

109 3D-to-2D Registration Similarly, we can formulate this as an optimization problem:

110 3D-to-2D Registration Similarly, we can formulate this as an optimization problem: 2D imageProjected image

111 3D-to-2D Registration Similarly, we can formulate this as an optimization problem: Iteration equation: 2D imageProjected image

112 3D-to-2D Registration Similarly, we can formulate this as an optimization problem: Iteration equation: 2D imageProjected image What’s ?

113 Interesting Registration applications 3D morphable face modeling from a single image Video-based motion capture


Download ppt "CSCE 641 Computer Graphics: Image Registration Jinxiang Chai."

Similar presentations


Ads by Google