PIXELBANKv8.2.1
Menu

Camera Calibration Matrix Decomposition

Decompose a 3×33 \times 3 upper-triangular camera intrinsic matrix KK into its individual parameters.

The intrinsic matrix KK has the form:

K=(fxscx0fycy001)K = \begin{pmatrix} f_x & s & c_x \\ 0 & f_y & c_y \\ 0 & 0 & 1 \end{pmatrix}

where:

  • fx,fyf_x, f_y are the focal lengths (in pixels) along the x and y axes
  • cx,cyc_x, c_y is the principal point (where the optical axis meets the image plane)
  • ss is the skew coefficient (usually 0 for modern cameras)

Given such a matrix, extract and return these parameters as a dictionary with keys 'fx', 'fy', 'cx', 'cy', and 'skew'.

This decomposition is a fundamental step in camera calibration and is used extensively in 3D reconstruction, augmented reality, and visual SLAM.

Example:

Input:
K = [[800.0, 0.0, 320.0],
     [0.0, 800.0, 240.0],
     [0.0, 0.0, 1.0]]
Output:
{'fx': 800.0, 'fy': 800.0, 'cx': 320.0, 'cy': 240.0, 'skew': 0.0}
Reasoning:
  • The given intrinsic matrix KK is a 3×33 \times 3 upper-triangular matrix with the form: K=(fxscx0fycy001)K = \begin{pmatrix} f_x & s & c_x \\ 0 & f_y & c_y \\ 0 & 0 & 1 \end{pmatrix}
  • We directly extract the values from the input matrix KK: fx=800.0f_x = 800.0, fy=800.0f_y = 800.0, cx=320.0c_x = 320.0, cy=240.0c_y = 240.0, and s=0.0s = 0.0.
  • These extracted values are then used to create a dictionary with the corresponding keys: 'fx', 'fy', 'cx', 'cy', and 'skew'.
  • The resulting dictionary is the output, containing the individual parameters of the camera intrinsic matrix: {'fx': 800.0, 'fy': 800.0, 'cx': 320.0, 'cy': 240.0, 'skew': 0.0}.

Constraints:

  • Input: A 3x3 upper-triangular intrinsic matrix K as a list of lists
  • K[2][2] is always 1
  • Return a dictionary with keys 'fx', 'fy', 'cx', 'cy', 'skew'
  • Values should be floats
Editor

Test Results

0/0
Run code to see test results.