Skip to content

Lens undistortion

Invert a calibrated lens model to map distorted observations onto an idealized camera image.

Try it on your image ↓

VISUAL WALKTHROUGH3D vision
REFERENCE INPUTLens-distorted grid

Straight scene lines appear curved under radial lens distortion.

RESULTRemap to a straight grid

Sampling through the inverse map straightens the grid. Border coverage depends on the chosen output camera.

STEP 03 / 03

Remap the image, or directly correct selected point coordinates.

Illustrative example. The stages explain the method; they are not a live OpenCV execution.

Try it on an image

YOUR IMAGE · REAL OPENCV

Experiment at pixel level

Open full lab ↗

Apply a known radial distortion model. Values are assumed calibration parameters, not estimates from this image.

The engine loads on your first run. Your images stay in this browser.

Input448 × 320
OutputWaiting for a result

Scroll over either image to zoom at the pointer. Use the scrollbars to pan both views over the same relative area. Zoom is relative to the input; pixel coordinates belong to each image. Warps can change scene correspondence.

Pixel inspector RGBA · native values · matched scale · 9 × 9 output pixels
Hover to inspect. Click to pin a pixel.
Input
Select a pixel

Output
Select a pixel

Sample models and licenses

When to use it

Straighten lens curvature and prepare measurements for geometric estimation.

How it works

  1. 01Use camera intrinsics and distortion coefficients.
  2. 02Build an inverse sampling map for the desired output camera.
  3. 03Remap the image, or directly correct selected point coordinates.

distorted pixels → calibrated inverse model → ideal coordinates

What to tune

Choose the new camera matrix to control crop and field of view. Cache maps for repeated frames of the same geometry.

Where it breaks down

The output may have uncovered borders or a changed field of view. Point APIs can return normalized coordinates unless a projection matrix is supplied.

TypeScript API

Open an entry for its exact overloads, parameter descriptions, result ownership and pinned upstream source.

All of these calls execute on the CPU. Native objects need explicit disposal. See matrices and ownership and build compatibility.