camera calibration
play

Camera calibration Digital Visual Effects, Spring 2006 Yung-Yu - PowerPoint PPT Presentation

Camera calibration Digital Visual Effects, Spring 2006 Yung-Yu Chuang 2005/4/19 with slides by Richard Szeliski, Steve Seitz, and Marc Pollefyes Announcements Artifacts for assignment #1 voting http:/ / www.csie.ntu.edu.tw/ ~cyy/ vfx/


  1. Camera calibration Digital Visual Effects, Spring 2006 Yung-Yu Chuang 2005/4/19 with slides by Richard Szeliski, Steve Seitz, and Marc Pollefyes

  2. Announcements • Artifacts for assignment #1 voting http:/ / www.csie.ntu.edu.tw/ ~cyy/ vfx/ assignm ents/ proj 1/ artifacts/ index.html

  3. Outline • Camera proj ection models • Camera calibration • Nonlinear least square methods • Bundle adj ustment

  4. Camera projection models

  5. Pinhole camera

  6. principal point Pinhole camera model (optical center) origin

  7. Pinhole camera model fX = x Z fY = y Z ⎛ ⎞ X ⎜ ⎟ ⎛ ⎞ ⎛ ⎞ ⎡ ⎤ x fX f 0 0 0 ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎢ ⎥ Y = ⎜ ⎟ ⎜ ⎟ y ~ fY 0 f 0 0 ⎜ ⎟ ⎢ ⎥ Z ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎢ ⎥ ⎝ ⎠ ⎝ ⎠ ⎣ ⎦ 1 Z 0 0 1 0 ⎜ ⎟ ⎝ ⎠ 1

  8. Pinhole camera model ⎛ ⎞ X ⎜ ⎟ ⎞ ⎡ ⎤ ⎡ ⎤ ⎛ ⎞ ⎛ x fX f 0 0 1 0 0 0 ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎢ ⎥ ⎢ ⎥ Y = ⎜ ⎟ ⎜ ⎟ y ~ fY 0 f 0 0 1 0 0 ⎜ ⎟ ⎢ ⎥ ⎢ ⎥ Z ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎢ ⎥ ⎢ ⎥ ⎝ ⎠ ⎝ ⎠ ⎣ ⎦ ⎣ ⎦ 1 Z 0 0 1 0 0 1 0 ⎜ ⎟ ⎝ ⎠ 1

  9. Principal point offset intrinsic matrix [ ] X x ~ K I 0 ⎛ ⎞ X ⎜ ⎟ ⎞ ⎡ ⎤ ⎡ ⎤ ⎛ ⎞ ⎛ x fX f 0 x 1 0 0 0 ⎜ ⎟ ⎜ ⎟ 0 ⎜ ⎟ ⎢ ⎥ ⎢ ⎥ Y = ⎜ ⎟ ⎜ ⎟ y ~ fY 0 f y 0 1 0 0 ⎜ ⎟ ⎢ ⎥ ⎢ ⎥ 0 Z ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎢ ⎥ ⎢ ⎥ ⎝ ⎠ ⎝ ⎠ ⎣ ⎦ ⎣ ⎦ 1 Z 0 0 1 0 0 1 0 ⎜ ⎟ ⎝ ⎠ 1

  10. Intrinsic matrix ⎡ ⎤ f 0 x Is this form of K good enough? 0 ⎢ ⎥ = K 0 f y ⎢ ⎥ 0 ⎢ ⎥ ⎣ ⎦ 0 0 1 • non-square pixels (digital video) • skew ⎡ ⎤ fa s x 0 ⎢ ⎥ • radial distortion = K 0 f y ⎢ ⎥ 0 ⎢ ⎥ ⎣ ⎦ 0 0 1

  11. Radial distortion

  12. Camera rotation and translation ⎛ ⎞ ⎛ ⎞ X ' X ⎜ ⎟ ⎜ ⎟ = + ⎜ ⎟ ⎜ ⎟ R t Y ' Y × 3 3 ⎜ ⎟ ⎜ ⎟ ⎝ ⎠ ⎝ ⎠ Z ' Z [ ] X ⎛ ⎞ X ⎜ ⎟ x ~ K R t ⎛ ⎞ ⎡ ⎤ x f 0 x ⎜ ⎟ 0 [ ] ⎜ ⎟ ⎢ ⎥ Y ⎜ ⎟ y ~ 0 f y R t ⎜ ⎟ ⎢ ⎥ 0 Z ⎜ ⎟ ⎜ ⎟ ⎢ ⎥ ⎝ ⎠ ⎣ ⎦ extrinsic matrix 1 0 0 1 ⎜ ⎟ ⎝ ⎠ 1

  13. Two kinds of parameters internal or intrinsic parameters such as focal • length, optical center, aspect ratio: what kind of camera? external or extrinsic (pose) parameters • including rotation and translation: where is the camera?

  14. Other projection models

  15. Orthographic projection • S pecial case of perspective proj ection – Distance from the COP to the PP is infinite Image World – Also called “ parallel proj ection ” : (x, y, z) → (x, y)

  16. Other types of projections • S caled orthographic – Also called “ weak perspective ” • Affine proj ection – Also called “ paraperspective ”

  17. Fun with perspective

  18. Perspective cues

  19. Perspective cues

  20. Fun with perspective Ames room

  21. Forced perspective in LOTR

  22. Camera calibration

  23. Camera calibration • Estimate both intrinsic and extrinsic parameters • Mainly, two categories: 1. Photometric calibration: uses reference obj ects with known geometry 2. S elf calibration: only assumes static scene, e.g. structure from motion

  24. Camera calibration approaches 1. linear regression (least squares) 2. nonlinear optinization 3. multiple planar patterns

  25. Chromaglyphs (HP research)

  26. Linear regression [ ] = x ~ K R t X MX

  27. Linear regression • Directly estimate 11 unknowns in the M matrix using known 3D points ( X i , Y i , Z i ) and measured feature positions ( u i , v i )

  28. Linear regression

  29. Linear regression

  30. olve for Proj ection Matrix M using least-square Linear regression techniques S

  31. Normal equation Given an overdetermined system Ax = b the normal equation is that which minimizes the sum of the square differences between left and right sides = T T A Ax A b Why?

  32. Normal equation ( ) = − 2 E ( x ) Ax b ⎡ ⎤ ⎡ ⎤ a ... a b 11 1 m 1 ⎢ ⎥ ⎢ ⎥ ⎡ ⎤ : : x : ⎢ ⎥ ⎢ ⎥ 1 ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ = : : : : ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎣ ⎦ : : x : ⎢ ⎥ ⎢ ⎥ m ⎢ ⎥ ⎢ ⎥ ⎣ ⎦ ⎣ ⎦ a ... a b n 1 nm n n x m, n equations , m variables

  33. Normal equation ⎡ ⎤ ⎛ ⎞ m ⎡ ⎤ ∑ m ⎜ ⎟ ∑ − ⎢ ⎥ a x b ⎜ ⎟ a x ⎢ ⎥ 1 j j 1 ⎡ ⎤ 1 j j ⎢ ⎝ ⎠ ⎥ b = ⎢ ⎥ j 1 = j 1 1 ⎢ ⎥ ⎢ ⎥ : ⎢ ⎥ : : ⎢ ⎥ ⎢ ⎥ ⎛ ⎞ ⎢ m ⎥ m ∑ ∑ ⎜ ⎟ ⎢ ⎥ − = − = − ⎢ ⎥ a x Ax b a x b b ⎜ ⎟ ⎢ ⎥ ij j i ij j i ⎢ ⎥ ⎢ ⎥ ⎝ ⎠ = = ⎢ ⎥ j 1 j 1 : ⎢ ⎥ ⎢ ⎥ : ⎢ ⎥ : ⎢ ⎥ ⎢ ⎥ m ⎛ ⎞ ⎣ ⎦ ∑ b ⎢ ⎥ m ∑ ⎜ ⎟ n ⎢ ⎥ a x − a x b ⎢ ⎥ ⎜ ⎟ nj j ⎣ ⎦ nj j n ⎢ ⎥ = ⎝ ⎠ ⎣ ⎦ j 1 = j 1 2 ⎡ ⎤ ⎛ ⎞ n m ( ) ∑ ∑ ⎜ ⎟ = − = − 2 ⎢ ⎥ E ( x ) Ax b a x b ⎜ ⎟ ij j i ⎢ ⎥ ⎝ ⎠ ⎣ ⎦ = = i 1 j 1

  34. Normal equation 2 ⎡ ⎤ ⎛ ⎞ n m ( ) ∑ ∑ ⎜ ⎟ = − = − 2 ⎢ ⎥ x Ax b E ( ) a x b ⎜ ⎟ ij j i ⎢ ⎥ ⎝ ⎠ ⎣ ⎦ = = i 1 j 1 ⎡ ⎤ ⎛ ⎞ ∂ n m ∑ ∑ E ⎜ ⎟ − = = ⎢ ⎥ 2 a x b a 0 ⎜ ⎟ ∂ ij j i i 1 ⎢ ⎥ ⎝ ⎠ x ⎣ ⎦ = = 1 i 1 j 1 n m n ∑ ∑ ∑ = − 2 a a x 2 a b i 1 ij j i 1 i = = = i 1 j 1 i 1 ∂ = E = = − T T T T → A Ax A b 0 2 ( A Ax A b ) ∂ x

  35. Linear regression • Advantages: – All specifics of the camera summarized in one matrix – Can predict where any world point will map to in the image • Disadvantages: – Doesn’ t tell us about particular parameters – Mixes up internal and external parameters • pose specific: move the camera and everything breaks

  36. Nonlinear optimization • Feature measurement equations • Likelihood of M given {( u i , v i )}

  37. Optimal estimation • Log likelihood of M given {( u i , v i )} • How do we minimize C ? • Non-linear regression (least squares), because û i and v i are non-linear functions of M • We can use Levenberg-Marquardt method to minimize it

  38. Multi-plane calibration Images courtesy Jean-Yves Bouguet, Intel Corp. Advantage • Only requires a plane • Don’ t have to know positions/ orientations • Good code available online! – Intel’ s OpenCV library: http:/ / www.intel.com/ research/ mrl/ research/ opencv/ – Matlab version by Jean-Yves Bouget: http:/ / www.vision.caltech.edu/ bouguetj / calib_doc/ index.html – Zhengyou Zhang’ s web site: http:/ / research.microsoft.com/ ~zhang/ Calib/

  39. Step 1: data acquisition

  40. Step 2: specify corner order

  41. tep 3: corner extraction S

  42. tep 3: corner extraction S

  43. Step 4: minimize projection error

  44. Step 4: camera calibration

  45. Step 4: camera calibration

  46. Step 5: refinement

  47. Nonlinear least square methods

  48. number of parameters number of data points Least square fitting

  49. Linear least square fitting y = = + y ( t ) M ( x , t ) x x t 0 1 = − f ( x ) y M ( x , t ) i i i t prediction residual = + + 3 M ( x , t ) x x t x t is linear, too. 0 1 2

  50. Nonlinear least square fitting

  51. Function minimization Least square is related to function minimization. It is very hard to solve in general. Here, we only consider a simpler problem of finding local minimum.

  52. Function minimization

  53. Quadratic functions Approximate the function with a quadratic function within a small neighborhood

  54. Quadratic functions A is positive definite. negative definite All eigenvalues are positive. Fall all x, x T Ax>0. A is singular A is indefinite

  55. Function minimization

  56. Descent methods

  57. Descent direction

  58. Steepest descent method the decrease of F(x) per unit along h direction → h sd is a descent direction because h T sd F’ (x)=- F’ (x) 2 <0 It has good performance in the initial stage of the iterative process. Converge very slow with a linear rate.

  59. gradient Steepest descent method isocontour

  60. Line search

  61. Hh h T T h h = α Line search

  62. Steepest descent method

  63. Newton’s method → → → → It has good performance in the final stage of the iterative process, where x is close to x*.

  64. Hybrid method This needs to calculate second-order derivative which might not be available.

Recommend


More recommend