Camera Intrinsic Parameters Explained: Focal Length, Principal Point, and Distortion

The intrinsic camera matrix K explained: what fx, fy, cx, cy and skew mean, how to build K from focal length, and how to spot bad intrinsics.

Camera Intrinsic Parameters Explained: Focal Length, Principal Point, and Distortion
Written by TechnoLynx Published on 11 Jul 2026

The intrinsic camera matrix K is the 3×3 matrix that maps a point in the camera’s own 3D frame to image coordinates. Its entries are fx and fy, the focal lengths expressed in pixels; (cx, cy), the principal point where the optical axis meets the image; and a skew term that is usually zero. Lens distortion coefficients also count as intrinsic camera parameters, but they sit outside K because the distortion they describe is non-linear and cannot be written into a linear matrix. A wrong K is easy to mistake for a weak perception model. It produces a systematic error that every projection in the pipeline inherits, and retraining the model does nothing to remove it.

The Intrinsic Camera Matrix, Entry by Entry

OpenCV writes the matrix in this layout, shown here with Zhang’s skew term (Zhang calls the same matrix A and uses α, β, γ, u0, v0 for its entries):

      | fx   s   cx |
K  =  | 0    fy  cy |
      | 0    0   1  |
Parameter What it represents physically Units and typical value
fx, fy Distance from the pinhole to the image plane, divided by the pixel width (fx) or pixel height (fy) Pixels; fx = f / sx and fy = f / sy
cx, cy Principal point: where the optical axis, perpendicular to the image plane, crosses it Pixels; usually close to the image centre
s (skew, γ) Skewness of the two image axes, which shears the projected image Often 0
k1, k2, k3 (radial) Bending of straight lines, growing away from the centre Coefficients of r², r⁴, r⁶
p1, p2 (tangential) Slight tangential distortion alongside the dominant radial term Applied to normalised coordinates

OpenCV supports radial terms k1 to k6, tangential p1 and p2, and thin-prism terms s1 to s4, passed as a vector of 4, 5, 8, 12 or 14 elements. OpenCV’s calibration tutorial solves for five coefficients (k1, k2, p1, p2, k3), and MathWorks states that most lenses can be modelled with five coefficients.

From Camera Coordinates to Pixels: The Order of Projection and Distortion

Intrinsic parameters describe the camera’s own perspective projection. A point at (X, Y, Z) in camera coordinates is first divided by its depth, giving normalised coordinates x = X/Z and y = Y/Z. In a calibrated model the distortion polynomial is then applied to those normalised coordinates, and only after that does K turn them into pixels: u = fx·x + s·y + cx and v = fy·y + cy.

One useful way to picture K is as a sequence of 2D operations on the normalised image: skew shears it, the focal lengths scale it into pixel units, and the principal point translates the result so the origin sits at the image corner rather than the optical axis.

Why Fx and Fy Can Differ

fx and fy differ because each one is the lens focal length divided by the pixel size along its own axis, so non-square pixels give different values. In Zhang’s 1998 experiments the measured aspect ratio α/β averaged 0.99995, which means essentially square pixels. OpenCV lets you either estimate fx and fy independently or tie them together with a fixed aspect ratio during calibration. Skew behaves the same way: there is no physical counterpart to skew in a true pinhole camera, though some digitisation processes can produce it. Zhang’s real-camera estimate of γ = 0.1401 with α = 832.85 corresponds to an angle of 89.99 degrees between the axes.

Why Distortion Stays Outside K but Is Still Intrinsic

Distortion coefficients are intrinsic because they do not depend on the scene. They are kept out of K because K is linear and lens distortion is not, so calibration algorithms estimate the coefficients by non-linear optimisation alongside the matrix. There is a practical benefit to the split. The coefficients stay the same when image resolution changes, while the matrix entries are rescaled.

Building the Intrinsic Matrix from Focal Length, Sensor Size and Resolution

The conversion from a lens focal length in millimetres to a focal length in pixels is: focal length in pixels = image width in pixels × focal length in mm / sensor width in mm. Metric3D v2 uses the same relation in its own terms: physical focal length divided by pixel size.

Worked Example: A 5.4 Mm Lens on a 1/2.7-Inch Sensor

The Photo Tourism project at the University of Washington works through a Canon PowerShot S100 photo: a 5.4 mm focal length, a 5.27 × 3.96 mm sensor and a 1600-pixel-wide image, which gives 1600 × 5.4 / 5.27 = 1639.47 pixels. To finish the matrix we add two assumptions of our own, which do not come from the source. The first is a 1600 × 1200 image, a 4:3 frame close to the sensor’s 5.27 × 3.96 mm proportions. The second is a principal point at the image centre.

  • fx = 1600 × 5.4 / 5.27 ≈ 1639.5 px
  • fy = 1200 × 5.4 / 3.96 ≈ 1636.4 px (same formula on the vertical axis)
  • cx = (1600 − 1) × 0.5 = 799.5 and cy = (1200 − 1) × 0.5 = 599.5, which is the centred convention OpenCV uses for its initial guess
  • s = 0

The roughly 3-pixel gap between fx and fy here comes from the datasheet dimensions and the assumed image height, not from a measurement of the pixels. A K built from datasheet values contains no distortion coefficients, which calibration estimates by non-linear optimisation.

What Changes in K When You Resize, Crop or Rectify

When an image is scaled by some factor, fx, fy, cx and cy all scale by that same factor, while the distortion coefficients stay unchanged. OpenCV gives the example directly: coefficients calibrated at 320 × 240 can be used unchanged at 640 × 480, as long as the four matrix entries are rescaled. Halving the worked example above to 800 × 600 gives fx ≈ 819.7 and cx ≈ 399.8 (arithmetic from the stated scaling rule).

Cropping is different. It changes the field of view and the optical centre and leaves the focal length alone, so cx and cy change while fx and fy stay put. Undistortion and rectification produce a new camera matrix with its own f′x, f′y, c′x, c′y, distinct from the original matrix. A calibration file made at capture resolution no longer fits a pipeline that crops or downsamples before inference unless fx, fy, cx and cy are adjusted.

How K Joins [R|t] to Form the Camera Projection Matrix

The full pinhole model is s·m = K [R | t]·M. Here M is a homogeneous 3D world point, [R | t] is the rotation and translation from world to camera coordinates (the extrinsics), and s is an arbitrary scale. The product K [R | t] is the 3×4 projection matrix P, and P links a world point directly to its pixel. OpenCV’s decomposeProjectionMatrix runs the composition backwards, splitting a 3×4 P into a 3×3 intrinsic matrix, a rotation and a translation.

The inverse goes the other way. K⁻¹ applied to a homogeneous pixel [u, v, 1] removes the principal point offset and the focal scaling and returns a direction in camera coordinates, which is the ray on which the 3D point must lie. OpenCV’s undistortion maps do the same thing with x = (u − cx)/fx and y = (v − cy)/fy. The same operation appears in the epipolar constraint, where K⁻¹ turns pixel correspondences into normalised coordinates before the essential matrix is applied. Zhang’s calibration uses it too, recovering each view’s rotation and translation from the homography through A⁻¹ once the intrinsics are known.

The two halves of P fail in different ways. Intrinsics stay fixed unless the lens or sensor is physically changed, while extrinsics describe where the camera sits on the vehicle. The reasons a vehicle-mounted camera’s pose moves while K stays put, and what to monitor because of it, are covered in our piece on intrinsics versus extrinsics and what drifts in a vehicle. How that pose error reaches downstream outputs is covered in the article on extrinsic calibration and camera pose. One qualification applies to “fixed”: a K estimated at one zoom setting is only reusable while the focal length stays the same.

How Are Camera Intrinsic Parameters Estimated with a Checkerboard Target?

Checkerboard calibration photographs a flat pattern of known geometry from several orientations and solves for the parameters that best explain where the corners appear. This is Zhang’s plane-based method. Each view of the plane gives a homography, and each homography contributes only two constraints on the intrinsics, because a homography has 8 degrees of freedom and 6 of them go to the view’s rotation and translation. Stacking N views gives a unique solution, up to scale, once N ≥ 3.

The estimate is made in two stages. A closed-form solution first computes the intrinsics assuming no distortion. A non-linear maximum-likelihood refinement then refines that estimate, distortion included. The order matters. Zhang reports that the closed-form step can produce distortion of the wrong shape (pincushion where the real lens has barrel distortion), and the refinement is what recovers the correct shape.

Several details decide whether the result is any good:

  • Coverage to the corners. A distortion model is only validated over the radius the calibration points actually reach. One 2026 study had points out to r = 841 px against r = 1126 px at the image corner, where the two models’ radial scale factors diverged.
  • Clean corner detection. The same study only admits images where the full inner corner grid is recovered, because extraction fails mainly under motion blur and at extreme incidence, and those are the conditions in which corner bias leaks into the shared intrinsics.
  • A sensible initial guess. The ViSP documentation warns that with near-HD or larger images, or long focal lengths, the default initialisation may be too far from the solution for the optimiser to converge.
  • Fixed focus. An autofocus lens refocuses on the checkerboard in each image, so the focal length is not constant, and fitting one constant-focal pinhole model across different distances introduces a systematic error.
  • Care with a guessed principal point. Hartley and Kaucic (ECCV 2002) show that small changes in an estimated or merely guessed principal point can cause very large changes in the estimated focal length. OpenCV’s CALIB_FIX_PRINCIPAL_POINT flag holds the principal point fixed during optimisation, so the value it is fixed at needs to be right.

How Do You Judge Whether an Intrinsic Calibration Is Good?

Start with the reprojection error, but don’t trust it alone. The reprojection error is the distance between each detected pattern corner and the same world point projected through the estimated parameters. The ViSP documentation treats a global reprojection error below 1.0 as a good calibration. MathWorks’ worked checkerboard example reports an overall mean error of 0.19 pixels.

A good calibration report goes further than one mean number:

  • Parameter standard errors. MathWorks’ estimateCameraParameters can return a standard error for each parameter, which gives confidence intervals on fx, cx and the rest.
  • Residuals against radius. In one 2026 study, per-view residuals under an under-fitted distortion model rose from 0.23 to 0.74 px toward the border, while a higher-order model stayed near 0.15 px. A small mean can hide that kind of pattern.
  • Sensitivity to model choice. In the same study, changing the distortion order shifted fx by 11 px. If fx moves that much when the model changes, the focal length is less settled than its reprojection error suggests.
  • Agreement across repeat calibrations. Recalibrating from a fresh set of views and comparing fx, fy, cx, cy and the distortion coefficients tests repeatability, which a single run’s residual cannot show.
  • Physical plausibility. OpenCV states that radial distortion is always monotonic for real lenses, and a non-monotonic estimate should be treated as a calibration failure.

Low reprojection error is not sufficient on its own. Focal length, principal point and camera position are coupled tightly enough that different parameter sets can fit the same checkerboard data with zero reprojection error, because an error in one is absorbed by the others. A photogrammetry study goes further. On coherent distortion, reprojection RMSE ranked models worse than chance (AUROC 0.15), because a coherent warp lowers the residuals. That study’s setting is survey photogrammetry with ground control points, not a single camera on a vehicle. The mechanism still carries over to calibration in general: a residual measures self-consistency, and self-consistency is not the same as correctness.

How Does a Wrong Intrinsic Estimate Distort 3D-to-2D Projection Across the Whole Image?

A wrong K distorts every projected point, not only those near the edges, because the matrix entries act on every pixel. From u = fx·x + cx, an error Δ in cx shifts every projected point horizontally by the same Δ pixels, whatever its position in the image. An error in fx behaves differently: the shift is zero at the principal point and grows in proportion to distance from it.

Each pixel passes through K⁻¹, so a wrong focal length gives every ray the wrong angle, and a wrong principal point tilts the whole bundle of rays. Focal length matters directly for metric depth. Metric3D v2 points out that two cameras whose focal lengths differ by a factor of two, placed at distances that also differ by a factor of two, produce identically sized images, so visual cues alone cannot settle metric depth.

Distortion errors behave differently. Radial distortion grows with distance from the image centre. In the 2026 study above, an under-fitted distortion model showed residuals rising toward the border. An edge-concentrated error points at the distortion model. A uniform offset, or a scale error spread across the whole frame, points at K.

Bad Intrinsics or a Bad Model? How a Perception Team Can Tell

One sign of a bad intrinsic matrix is that the error belongs to the camera rather than the data. It repeats in the same direction across scenes, object classes and model versions, and it survives retraining. A perception model’s errors usually depend on the content, so they change with lighting, class and context. A small, constant offset in object centroids that no retraining removes is exactly what a few-pixel principal point error would produce.

Diagnostic Checklist

  1. Check resolution consistency. Confirm that the K in use matches the resolution and crop the model actually receives, and that a rectified stream is using the new camera matrix.
  2. Map the error spatially. A constant offset suggests cx or cy. Error proportional to distance from centre suggests fx or fy. Error concentrated at the border suggests the distortion model.
  3. Compare across camera units. If the bias follows one physical camera and not the scene, the calibration is the suspect.
  4. Reproject a known target. Measure the reprojection error of a calibration pattern under the deployed K and distortion, looking at the residual pattern as well as the mean.
  5. Recalibrate and compare. A fresh calibration whose fx or cx differs materially from the deployed values is evidence on its own.
  6. Check the lens hardware. Autofocus or zoom means the calibrated focal length may not be the one in use.

A step like this belongs in the checks a perception robustness audit runs before a release, and for tracking see why calibration matters to a tracking model. When TechnoLynx audits an automotive perception pipeline in its computer vision R&D engagements, verifying intrinsic calibration is part of the silent-failure checks made before any error is attributed to the model.

FAQ

What Is a 3D Projection Onto an Image Called?

Mapping 3D points onto a 2D image plane through a single centre of projection is perspective projection, which the pinhole model formalises.

What Happens to a Pinhole Camera Image When the Hole Is Made Bigger?

The image gets brighter and blurrier, because each scene point now lights a small disc on the image plane instead of a single point.