Decompose a 3x4 projection matrix into K, R, and C

[K, R, C] = KRC_from_P(P [, noscale])

- P
- 3x4 real matrix.
- K
- 3x3 upper triangular real matrix of intrinsic parameters
- R
- 3x3 rotation matrix
- C
- 3x1 vector indicating the camera center in world coordinates
- noscale
- Optional parameter. If present, then no scaling will be done in order to guarantee that K(1,1) > 0 and K(3,3) = 1.

Function `KRC_from_P`

decomposes a 3x4 camera matrix
`P`

into
intrinsic parameters `K`

, rotation `R`

, and
center of projection `C`

. A decomposition is chosen for which
`det(R) = 1`

and `K`

is scaled so that
`K(3,3) = 1`

and `K(1,1) > 0`

. The optional
parameter `noscale`

prevents this scaling. Note also that you
might want to enforce `K(2,2) > 0`

, and depending on your
convention for the camera coordinate system you might have to multiply the
result by certain matrices to change signs.

K = [1200 0.3 500 0 1200 600 0 0 1 ]; R = eye(3,3); T = [3; 4; 5]; P = K*[R T] [KK,RR,CC] = KRC_from_P(P) // note that CC = -R'T. |

- Ricardo Fabbri <ricardofabbri (AT) users DOT sf DOT net>

http://siptoolbox.sourceforge.net