Camera calibration technique

Post on 21-Mar-2017

33 views 3 download

transcript

Camera calibration techniquewprowadzenie teoretyczne

Krzysztof WegnerChair of Multimedia Telecommunications and Microelectronics

PoznaΕ„ University of Technology, Poland

1

Goal of the calibration Knowledge about

Intrinsic camera parameters Focal length Optical center

Extrinsic camera parameters -Position of the camera in 3D world

Orientation of the camera Translation

2

Goal of the calibration Knowledge about

Intrinsic camera parameters Focal length Optical center

Extrinsic camera parameters -Position of the camera in 3D world

Orientation of the camera Translation Common word coordinate system

3

Camera parameters Intrinsic camera parameters

Focal length Optical center

Extrinsic camera parameters -Position of the camera in 3D world

Orientation of the camera Translation

4

𝑨=[ 𝑓 𝑒 𝛾 π‘œπ‘’

0 𝑓 𝑣 π‘œπ‘£

0 0 1 ]

𝑹=[π’“πŸ π’“πŸ π’“πŸ‘ ]𝑻=[𝑑π‘₯𝑑𝑦𝑑 𝑧 ]

Camera model Projection of a 3D point Onto a point at image plane

s is a scale – distance to the point

5

𝑠 βˆ™[𝑒𝑣1 ]=𝐴 βˆ™ [𝑅 βˆ’π‘… βˆ™π‘‡ ] βˆ™ [π‘‹π‘Œπ‘1 ]

Zhang’s Algorithm Allows estimation of

intrinsic parameters - matrix extrinsic parameters – rotation matrix and

translation vector Planar template

6Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

𝑠 βˆ™[𝑒𝑣1 ]=𝐴 βˆ™ [π‘Ÿ 1 π‘Ÿ2 π‘Ÿ 3~𝑑 ] βˆ™ [ π‘‹π‘Œπ‘1 ]

Zhang’s algorithm Planar template

7Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

Zhang’s algorithm Planar template

8Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

Estimating Homography H We know position of the pattern’s feature points From registrated image we know

So

9Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

Estimating Homography H We know position of the pattern’s feature points From registrated image we know

10Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

Estimating Homography H

Let’s assign

We have 2 equations and 9 variables so we need at least 5 points to solve uniquely for

11Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

Estimating Homography H Defined up to a scale factor We know position of the pattern’s feature points From registrated image we know

Multiplication of both side by don’t change known

So we don’t know whether we obtain or So we don’t know scale of the scene

12Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

πœ† βˆ™π‘  βˆ™ [𝑒𝑣1 ]=𝝀 βˆ™π‘― βˆ™[ π‘‹π‘Œ1 ] πœ† βˆ™π‘  βˆ™[𝑒𝑣1 ]=~𝑯 βˆ™[ π‘‹π‘Œ1 ]

Homography H Defined up to a scale factor We know position of the pattern’s feature points From registrated image we know

13Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

Homography H Defined up to a scale factor We know position of the pattern’s feature points From registrated image we know

Multiplication of both side by don’t change known

14Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

πœ† βˆ™π‘  βˆ™ [𝑒𝑣1 ]=𝝀 βˆ™π‘― βˆ™[ π‘‹π‘Œ1 ]πœ† βˆ™π‘  βˆ™ [𝑒𝑣1 ]=~𝑯 βˆ™[ π‘‹π‘Œ1 ]

Homography H Defined up to a scale factor

Multiplication of both side by don’t change known

So we don’t know whether we obtain or So we don’t know Z scale of the scene

15Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

πœ† βˆ™π‘  βˆ™ [𝑒𝑣1 ]=𝝀 βˆ™π‘― βˆ™[ π‘‹π‘Œ1 ]πœ† βˆ™π‘  βˆ™ [𝑒𝑣1 ]=~𝑯 βˆ™[ π‘‹π‘Œ1 ]

Constraints on the intrinsic Vectors , are orthonormal so taking dot product

gives

and length of , should be the same

For

we have

and

16Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

π’“πŸπ‘» βˆ™π’“πŸ=𝟎

‖𝒓 πŸβ€–πŸ=β€–π’“πŸβ€–

πŸβŸΉπ’“πŸπ‘» βˆ™π’“ 𝟏=π’“πŸ

𝑻 βˆ™π’“πŸ

Constraints on the intrinsic Puting all together

17Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

π’“πŸπ‘» βˆ™π’“πŸ=𝟎

π’“πŸπ‘» βˆ™π’“πŸ=𝒓 𝟐

𝑻 βˆ™π’“πŸ

(πœ†βˆ’1 βˆ™π‘¨βˆ’πŸ βˆ™π’‰πŸ )𝑻 βˆ™πœ†βˆ’1 βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ=πŸŽπ’‰πŸ

𝑻 βˆ™π‘¨βˆ’π‘» βˆ™πœ†βˆ’1βˆ™ πœ†βˆ’ 1 βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ=πŸŽπ’‰πŸ

𝑻 βˆ™π‘¨βˆ’π‘» βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ=𝟎

(πœ†βˆ’1 βˆ™π‘¨βˆ’πŸ βˆ™π’‰πŸ )𝑻 βˆ™ πœ†βˆ’1 βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ=(πœ†βˆ’ 1 βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ )𝑻 βˆ™πœ†βˆ’1 βˆ™π‘¨βˆ’πŸ βˆ™π’‰πŸ

π’‰πŸπ‘» βˆ™π‘¨βˆ’π‘» βˆ™ πœ†βˆ’1 βˆ™πœ†βˆ’ 1 βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ=π’‰πŸ

𝑻 βˆ™π‘¨βˆ’π‘» βˆ™πœ†βˆ’ 1 βˆ™πœ†βˆ’ 1 βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ

π’‰πŸπ‘» βˆ™π‘¨βˆ’π‘» βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ=π’‰πŸ

𝑻 βˆ™ π‘¨βˆ’π‘» βˆ™π‘¨βˆ’πŸ βˆ™π’‰πŸ

Constraints on the intrinsic Puting all together

18Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

π’“πŸπ‘» βˆ™π’“πŸ=𝟎

π’“πŸπ‘» βˆ™π’“πŸ=𝒓 𝟐

𝑻 βˆ™π’“πŸ

(πœ†βˆ’1 βˆ™π‘¨βˆ’πŸ βˆ™π’‰πŸ )𝑻 βˆ™πœ†βˆ’1 βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ=πŸŽπ’‰πŸ

𝑻 βˆ™π‘¨βˆ’π‘» βˆ™πœ†βˆ’1βˆ™ πœ†βˆ’ 1 βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ=πŸŽπ’‰πŸ

𝑻 βˆ™π‘¨βˆ’π‘» βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ=𝟎

(πœ†βˆ’1 βˆ™π‘¨βˆ’πŸ βˆ™π’‰πŸ )𝑻 βˆ™ πœ†βˆ’1 βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ=(πœ†βˆ’ 1 βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ )𝑻 βˆ™πœ†βˆ’1 βˆ™π‘¨βˆ’πŸ βˆ™π’‰πŸ

π’‰πŸπ‘» βˆ™π‘¨βˆ’π‘» βˆ™ πœ†βˆ’1 βˆ™πœ†βˆ’ 1 βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ=π’‰πŸ

𝑻 βˆ™π‘¨βˆ’π‘» βˆ™πœ†βˆ’ 1 βˆ™πœ†βˆ’ 1 βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ

π’‰πŸπ‘» βˆ™π‘¨βˆ’π‘» βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ=π’‰πŸ

𝑻 βˆ™ π‘¨βˆ’π‘» βˆ™π‘¨βˆ’πŸ βˆ™π’‰πŸ

Closed form solution Try to solve

Intrinsic matrix

Let’s assign

19Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

𝑨=[ 𝑓 𝑒 𝛾 π‘œπ‘’

0 𝑓 𝑣 π‘œπ‘£

0 0 1 ]π’‰πŸ

𝑻 βˆ™π‘¨βˆ’π‘» βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ=πŸŽπ’‰πŸ

𝑻 βˆ™π‘¨βˆ’π‘» βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ=π’‰πŸπ‘» βˆ™ π‘¨βˆ’π‘» βˆ™π‘¨βˆ’πŸ βˆ™π’‰πŸ

𝑩=π‘¨βˆ’π‘» βˆ™ π‘¨βˆ’πŸ

𝑩=[1𝑓 𝑒2

βˆ’π›Ύπ‘“ 𝑒2 𝑓 𝑣

π‘œπ‘£π›Ύβˆ’ 𝑓 π‘£π‘œπ‘’

𝑓 𝑒2 𝑓 𝑣

βˆ’π›Ύπ‘“ 𝑒2 𝑓 𝑣

1𝑓 𝑣

2+𝛾2

𝑓 𝑒2 𝑓 𝑣

2

βˆ’π‘œπ‘£β‘

𝑓 𝑣2 βˆ’

𝛾 (π‘œπ‘£π›Ύβˆ’ 𝑓 π‘£π‘œπ‘’)𝑓 𝑒2 𝑓 𝑣

2

π‘œπ‘£π›Ύβˆ’ 𝑓 π‘£π‘œπ‘’

𝑓 𝑒2 𝑓 𝑣

βˆ’π‘œπ‘£β‘

𝑓 𝑣2 βˆ’

𝛾 (π‘œπ‘£π›Ύβˆ’ 𝑓 π‘£π‘œπ‘’ )𝑓 𝑒2 𝑓 𝑣

2 1+π‘œπ‘£

2

𝑓 𝑣2 +

(π‘œπ‘£π›Ύβˆ’ 𝑓 π‘£π‘œπ‘’ )2

𝑓 𝑒2 𝑓 𝑣

2]=[𝐡11 𝐡12 𝐡13

𝐡12 𝐡22 𝐡23

𝐡13 𝐡23 𝐡33]

Closed form solution Let’s assign

is symetrical Let’s assign

20Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

𝑩=π‘¨βˆ’π‘» βˆ™ π‘¨βˆ’πŸ

𝑩=[1𝑓 𝑒2

βˆ’π›Ύπ‘“ 𝑒2 𝑓 𝑣

π‘œπ‘£π›Ύβˆ’ 𝑓 π‘£π‘œπ‘’

𝑓 𝑒2 𝑓 𝑣

βˆ’π›Ύπ‘“ 𝑒2 𝑓 𝑣

1𝑓 𝑣

2+𝛾2

𝑓 𝑒2 𝑓 𝑣

2

βˆ’π‘œπ‘£β‘

𝑓 𝑣2 βˆ’

𝛾 (π‘œπ‘£π›Ύβˆ’ 𝑓 π‘£π‘œπ‘’)𝑓 𝑒2 𝑓 𝑣

2

π‘œπ‘£π›Ύβˆ’ 𝑓 π‘£π‘œπ‘’

𝑓 𝑒2 𝑓 𝑣

βˆ’π‘œπ‘£β‘

𝑓 𝑣2 βˆ’

𝛾 (π‘œπ‘£π›Ύβˆ’ 𝑓 π‘£π‘œπ‘’ )𝑓 𝑒2 𝑓 𝑣

2 1+π‘œπ‘£

2

𝑓 𝑣2 +

(π‘œπ‘£π›Ύβˆ’ 𝑓 π‘£π‘œπ‘’ )2

𝑓 𝑒2 𝑓 𝑣

2]=[𝐡11 𝐡12 𝐡13

𝐡12 𝐡22 𝐡23

𝐡13 𝐡23 𝐡33]

𝒃=[𝐡11 𝐡12 𝐡13 𝐡22 𝐡23 𝐡33 ]

Closed form solution We try to solve

Let’s see pattern in the equations

21Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

π’‰πŸπ‘» βˆ™π‘¨βˆ’π‘» βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ=𝟎

π’‰πŸπ‘» βˆ™π‘¨βˆ’π‘» βˆ™ π‘¨βˆ’πŸ βˆ™π’‰πŸ=π’‰πŸ

𝑻 βˆ™ π‘¨βˆ’π‘» βˆ™π‘¨βˆ’πŸ βˆ™π’‰πŸ

𝑩=π‘¨βˆ’π‘» βˆ™ π‘¨βˆ’πŸ

π’‰πŸπ‘» βˆ™π‘© βˆ™π’‰πŸ=πŸŽπ’‰πŸ

𝑻 βˆ™π‘© βˆ™π’‰πŸ=π’‰πŸπ‘» βˆ™π‘© βˆ™π’‰πŸ

π’‰π’Šπ‘» βˆ™π‘© βˆ™π’‰ 𝒋=π’—π’Šπ’‹

𝑻 βˆ™π’ƒ=

¿𝐡11 βˆ™ h𝑖1 βˆ™ h 𝑗 1+𝐡12 βˆ™ h𝑖1 βˆ™ h 𝑗2+𝐡13 βˆ™ h𝑖1 βˆ™ h 𝑗3+ΒΏ

ΒΏ π’—π’Šπ’‹π‘» βˆ™π’ƒ

+ ++

𝒗 π’Šπ’‹π‘»=[h𝑖 1 βˆ™ h 𝑗 1 h𝑖1 βˆ™ h 𝑗 2+h𝑖2 βˆ™ h 𝑗1 h𝑖1 βˆ™h 𝑗3+h𝑖3 βˆ™ h 𝑗 1 h𝑖2 βˆ™ h 𝑗 2 h𝑖 2 βˆ™ h 𝑗 3+h𝑖 3 βˆ™ h 𝑗2 h𝑖3 βˆ™ h 𝑗3 ]

Closed form solution We try to solve

so

22Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

π’‰πŸπ‘» βˆ™π‘© βˆ™π’‰πŸ=πŸŽπ’‰πŸ

𝑻 βˆ™π‘© βˆ™π’‰πŸβˆ’π’‰πŸπ‘» βˆ™π‘© βˆ™π’‰πŸ=𝟎

π’‰π’Šπ‘» βˆ™π‘© βˆ™π’‰ 𝒋=π’—π’Šπ’‹

𝑻 βˆ™π’ƒ

π’—πŸπŸπ‘» βˆ™π’ƒ=πŸŽπ’—πŸπŸπ‘» βˆ™π’ƒβˆ’π’—πŸπŸ

𝑻 βˆ™π’ƒ=πŸŽπ’—πŸπŸπ‘» βˆ™π’ƒ=𝟎

(π’—πŸπŸπ‘» βˆ’π’—πŸπŸ

𝑻 ) βˆ™π’ƒ=𝟎

[ π’—πŸπŸπ‘»

(π’—πŸπŸβˆ’π’—πŸπŸ )𝑻 ] βˆ™π’ƒ=𝟎

Solving for b

Two equation are defined but have 6 unknowns. So at least 3 images are required to uniquly solve for Because all images are captured with the same

camera we can stack equation for together

23Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

[ π’—πŸπŸπ‘»

(π’—πŸπŸβˆ’π’—πŸπŸ )𝑻 ] βˆ™π’ƒ=𝟎

[ π’—πŸπŸβ€²π‘»

(𝒗 β€²πŸπŸβˆ’π’— β€²πŸπŸ)𝑻 ] βˆ™π’ƒ=𝟎

[ 𝒗 β€² β€²πŸπŸπ‘»

(𝒗 β€² β€²πŸπŸβˆ’π’— β€² β€²πŸπŸ )𝑻 ]βˆ™π’ƒ=𝟎

[ π’—πŸπŸπ‘»

(π’—πŸπŸβˆ’π’—πŸπŸ )𝑻 ] βˆ™π’ƒ=𝟎

[π’—πŸπŸπ‘»

(π’—πŸπŸβˆ’π’—πŸπŸ )𝑻

π’—πŸπŸβ€²π‘»

(𝒗 β€²πŸπŸβˆ’π’— β€²πŸπŸ )𝑻

𝒗 β€² β€²πŸπŸπ‘»

(𝒗 β€² β€²πŸπŸβˆ’π’— β€² β€²πŸπŸ)𝑻] βˆ™π’ƒ=πŸŽπ‘½=[

π’—πŸπŸπ‘»

(π’—πŸπŸβˆ’π’—πŸπŸ )𝑻

π’—πŸπŸβ€²π‘»

(𝒗 β€²πŸπŸβˆ’π’— β€²πŸπŸ)𝑻

𝒗 β€² β€²πŸπŸπ‘»

(𝒗 β€² β€²πŸπŸβˆ’π’— β€² β€²πŸπŸ )𝑻]

Solving for b

There is trivia solution

But we look for non trivial solution so Such solution is given by eigenvector of

asociated with the smallest eigenvalue (right singulart vector of

24Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

𝑽 βˆ™π’ƒ=𝟎

𝑽 𝑻 βˆ™π‘½

Retriving intrinsic parameters Once we have We can calculate intrinsic parameters from

25Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

𝑩=[1𝑓 𝑒2

βˆ’π›Ύπ‘“ 𝑒2 𝑓 𝑣

π‘œπ‘£π›Ύβˆ’ 𝑓 π‘£π‘œπ‘’

𝑓 𝑒2 𝑓 𝑣

βˆ’π›Ύπ‘“ 𝑒2 𝑓 𝑣

1𝑓 𝑣

2+𝛾2

𝑓 𝑒2 𝑓 𝑣

2

βˆ’π‘œπ‘£β‘

𝑓 𝑣2 βˆ’

𝛾 (π‘œπ‘£π›Ύβˆ’ 𝑓 π‘£π‘œπ‘’)𝑓 𝑒2 𝑓 𝑣

2

π‘œπ‘£π›Ύβˆ’ 𝑓 π‘£π‘œπ‘’

𝑓 𝑒2 𝑓 𝑣

βˆ’π‘œπ‘£β‘

𝑓 𝑣2 βˆ’

𝛾 (π‘œπ‘£π›Ύβˆ’ 𝑓 π‘£π‘œπ‘’ )𝑓 𝑒2 𝑓 𝑣

2 1+π‘œπ‘£

2

𝑓 𝑣2 +

(π‘œπ‘£π›Ύβˆ’ 𝑓 π‘£π‘œπ‘’ )2

𝑓 𝑒2 𝑓 𝑣

2]=[𝐡11 𝐡12 𝐡13

𝐡12 𝐡22 𝐡23

𝐡13 𝐡23 𝐡33]

𝒃=[𝐡11 𝐡12 𝐡13 𝐡22 𝐡23 𝐡33 ]

π‘œπ‘£=𝐡12 βˆ™π΅13βˆ’π΅11 βˆ™π΅23

𝐡11 βˆ™π΅22βˆ’π΅122𝑓 𝑒=√ πœ†

𝐡11

πœ†=𝐡33βˆ’π΅132 +π‘œπ‘£ (𝐡12 βˆ™π΅13βˆ’π΅11 βˆ™π΅23 )

𝐡11

𝑓 𝑣=√ πœ† βˆ™π΅11

𝐡11 βˆ™π΅22βˆ’π΅122

𝛾=βˆ’π΅12 βˆ™ 𝑓 𝑒2 βˆ™ 𝑓 𝑣

πœ†π‘œπ‘’=

𝛾 βˆ™π‘œπ‘£

𝑓 π‘£βˆ’π΅13

𝑓 𝑒2

πœ†

Retriving position We know constraints

To complete rotation matrix we calculater third column

Finally we ortonormalize rotation matrix

26Z. Zhang, β€œA flexible new technique for camera calibration”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):1330–1334, 2000

π’“πŸ‘=π’“πŸΓ—π’“ 𝟐

‖𝒓 πŸβ€–=β€–π’“πŸβ€–=β€–π’“πŸ‘β€–=𝟏

Summary Camera parameters requires at least 5

point pattern Intrinsic camera parameters estimation

requires at least 3 images at different orientation

All parameters are defined up to a unknown scale

M37232, October 2015, Geneve 27