Vision 7CameraModelA S09

Embed Size (px)

Citation preview

  • 8/19/2019 Vision 7CameraModelA S09

    1/28

    I‐Chen Lin, Assistant Professor

    Computer Vision:

     7.

     Camera

     Models

     (a)

    Dept. of  CS, National Chiao Tung University

  • 8/19/2019 Vision 7CameraModelA S09

    2/28

  • 8/19/2019 Vision 7CameraModelA S09

    3/28

     

    •   Coordinates x and y

    •  For

     a

     more

     general

     coordinate

     representation,

     we

     usually

     use

     a vec or  orm.

     j 

    ⋅=p =(x,y)

    T

     jop y   ⋅=

    o

  • 8/19/2019 Vision 7CameraModelA S09

    4/28

     

    •   Line l : ax+by =c  (a,b)T ( x,y )=c

     j

    p=(x,y)Tc

    i

    (a,b)T

  • 8/19/2019 Vision 7CameraModelA S09

    5/28

     

    •   Uniform treatment of  points and lines

    •  Line

    ‐point

     incidence:

     l T 

     p=0

     j

    stay the same when scaled:

    p=(x,y,1)T~(kx,kx,k)Tc

    i

    (a,b)T   l=(a,b,‐c)T~(ka,kb,‐kc)T

  • 8/19/2019 Vision 7CameraModelA S09

    6/28

     .

    •   Furthermore, …

     –   We use

     homogenous

     coordinates

     to

     combine

     rotation

     and

     

    translation into same framework: matrix transformation.

     – 

      It allows

     easy

     transformation

     between

     “frames”

      – common

     between computer vision and graphics.

  • 8/19/2019 Vision 7CameraModelA S09

    7/28

     

    •   To apply the camera model, objects in the scene must be 

    expressed 

    in 

    camera coordinates.

     y

    Camera

    w

    c

    T   x z

    World

    Coordinates

    Coordinates z

    Calibration target looks tilted from camera

    viewpoint. This can be explained as a

    difference in coordinate s stems.

     x 

  • 8/19/2019 Vision 7CameraModelA S09

    8/28

     

    ‐ ‐

    body.

    •   .

    •   R, t : the extrinsic parameters.

    y (0, 1, 0)

    v (vx, vy, vz)

    w (wx, wy, wz)

    v’w’

    optic axisc

    x (1,0,0)

     

    u (ux, uy, uz)

     u’

  • 8/19/2019 Vision 7CameraModelA S09

    9/28

    •  

    •  AP is coordinates of  P in frame A

    •  BP

     is

     coordinates

     of 

     P

     in

     frame

     B

     A

     A x

     A

     ⎜ ⎟

     A A A=   y A

     z

     ⎠

    ⎟=   x •   A   y •   A   z •   A A

     A

    i A

    O A

  • 8/19/2019 Vision 7CameraModelA S09

    10/28

     B

    P=

     A

    P+

     B

    O A( )k  B

     j BO B

     A   B

     A

    i A

    O A

  • 8/19/2019 Vision 7CameraModelA S09

    11/28

    •   Using homogeneous coordinates, translation can be 

    expressed 

    as 

    matrix 

    multiplication. B A B

     AP P O= +

    1 0 1 1

     B B A

     AP I O P=⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎣ ⎦ ⎣ ⎦ ⎣ ⎦

    •   Translation is commutative

  • 8/19/2019 Vision 7CameraModelA S09

    12/28

     A B x x⎛ ⎞ ⎛ ⎞( ) ( ) A B A A A B B B

     A B

    OP i j k y i j k y

     z z

    = =⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟⎝ ⎠ ⎝ ⎠

    uuuv

     B B A=

    means describing

     frame

     A

     in

     A R   The coordinate system of  

    frame B

  • 8/19/2019 Vision 7CameraModelA S09

    13/28

     

    . . . A B A B A B

     B

    ⎡ ⎤⎢ ⎥

    i i j i k i

    . . .

    . . .

     A A B A B A B

     A B A B A B⎢ ⎥⎣ ⎦i k j k k k

     B B B

     A A A⎡ ⎤= ⎣ ⎦i j k

     A T 

     B

     A T 

    ⎡ ⎤

    ⎢ ⎥

    i

     B

     A T 

     B

    =⎢ ⎥k

    Orthogonal matrix:  R-1 =  RT 

  • 8/19/2019 Vision 7CameraModelA S09

    14/28

     

    What is the rotation matrix?

  • 8/19/2019 Vision 7CameraModelA S09

    15/28

     

    ’ ’’  ,  , 

    •   Heading, pitch roll: world Z, new X, new Y

    ’  , 

    focus on that

    ⎥⎥

    ⎢⎢

    =   0)cos()sin(

    s ncos

    )(   θ θ θ  Z  R

    ⎥⎥⎥

    ⎢⎢⎢ −=

    cossin0

    )sin()cos(0)(   φ φ φ  X  R

    ⎡   )sin(0)cos(   κ κ 

    ⎥⎦⎢⎣−   )cos(0)sin(   κ κ Y 

    Remind: applying coordinate rotation φ is equal  to applying rotation –  φ to objects. 

  • 8/19/2019 Vision 7CameraModelA S09

    16/28

     

    •   s ng  omogeneous coor nates, rotat on can  e expresse  as a matrix multiplication.

     B B A

     AP R P=

    1 0 1 1 A=⎢ ⎥ ⎢ ⎥ ⎢ ⎥

    ⎣ ⎦ ⎣ ⎦ ⎣ ⎦

    •   Rotation is not commutative

  • 8/19/2019 Vision 7CameraModelA S09

    17/28

     

     B B A B A A

  • 8/19/2019 Vision 7CameraModelA S09

    18/28

     .

      .

    1 0 B B B AP O R P⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎡ ⎤

    1 0 1 0 1 1 B B A

    =⎣ ⎦ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦

    1 1

     A A

    T = ⎢ ⎥ ⎢ ⎥

    ⎣ ⎦ ⎣ ⎦0

    1 1

     B

     AT =⎢ ⎥ ⎢ ⎥

  • 8/19/2019 Vision 7CameraModelA S09

    19/28

     

    •   Linear transformation of  perspective projection coordinate.

    ⎤⎡ X 

    ⎥⎥

    ⎢⎢

    ⎥⎥

    ⎢⎢==⎥

    ⎥⎢⎢=   0010]0[

     Z 

    Y P I v p

    ⎦⎣ 1

    •   Recover image (normalized) coordinate by projection.

     X uˆ

    Y v

     Z w

    ==

    ==

    ˆ Z w

  • 8/19/2019 Vision 7CameraModelA S09

    20/28

     

    •   eca   perspect ve pro ect on

    http://commons.wikimedia.org/wiki/

    File:Taiwan_HighSpeedRail_Train_Business_Class_Car.JPG

  • 8/19/2019 Vision 7CameraModelA S09

    21/28

     

    )!OK(oftenconstantisdepthPretend 

    =ˆ Z 

    ur 

    =ˆ  Z v r 

    ⎤⎡⎤⎡   0001

     

     X 

    u

    ⎥⎥

    ⎢⎢

    ⎥⎥⎦⎢

    ⎢⎣

    =

    ⎥⎥⎦⎢

    ⎢⎣   000

    0010 Z 

     Z  Z 

    w

    v

  • 8/19/2019 Vision 7CameraModelA S09

    22/28

     

  • 8/19/2019 Vision 7CameraModelA S09

    23/28

     

    Pixels are on a grid of  a certain dimension

    [f] = m (in meters)

    [k] = pixels/m

  • 8/19/2019 Vision 7CameraModelA S09

    24/28

     

    We put the pixel coordinate origin on topleft

    O

    0  

  • 8/19/2019 Vision 7CameraModelA S09

    25/28

  • 8/19/2019 Vision 7CameraModelA S09

    26/28

     

    a r xna ra o

     X ⎤⎡

    ×

    0

    0

    0010]0[ Z 

    Y vP I K v p

    ⎥⎥

    ⎢⎢

    ⎥⎥

    ⎢⎢

    ⎥⎥

    ⎢⎢==⎥

    ⎥⎢⎢=   β 

    1

    w

    ⎦⎣

     

    u

    sY  X u

    u   +

    +

    ==

      α 

    0ˆ   v

    Y vv   +==

      β   skew

     

  • 8/19/2019 Vision 7CameraModelA S09

    27/28

     

    cot

    a r xna ra o

     xu   ⎤⎡⎤⎡   −

    ×

    θ α α 

    0   0010sin

    ]0[1

     z

     yvP I K 

     zv p

    ⎥⎥

    ⎢⎢

    ⎥⎥

    ⎢⎢

    ⎥⎢==⎥⎥

    ⎢⎢=

    θ 

     β 

    11

    ⎦⎣⎦⎣

    0

    cot

     

    u

     x

    u   +

    =

      θ α α 

    0v y

    v   +=  β 

  • 8/19/2019 Vision 7CameraModelA S09

    28/28

     x

     .

    •   Perspective projection mapping (including intrinsic and 

    extrinsic parameters).

     y

     x

    O R

    uuc

    w

    c

    w

    0001cot

    10 ⎥

    ⎤⎢⎡

    ⎤⎡⎥⎤

    ⎢⎡

    ⎥⎤

    ⎢⎡   −

    ⎥⎤

    ⎢⎡

     β 

    θ α α 

     z z1

    1001001sin1

    0

    ⎥⎥⎦

    ⎢⎢⎣

    ⎦⎣⎥⎦⎢⎣⎥⎦⎢⎣

    ==

    ⎥⎦⎢⎣

    =θ 

    [ ]   MP z

    PO RK 

     z

    c

    w

    c

    w

    11==

    5+6 DOF = 11 !