Appearance
Undistort Image
Overview
Some cameras and lenses introduce distortion that causes straight lines to appear curved. This node removes barrel or pincushion distortion from camera images, which is essential for wide-angle or fisheye lenses where this effect can interfere with accurate geometric measurements.

For background on how camera undistortion works, see the OpenCV camera calibration tutorial.
Use Undistort Image when:
- You use wide-angle lenses that cause "bowing" at the edges of the frame.
- Precise alignment or measurement is required across the entire field of view.
💡 Tip
To configure this node correctly, observe how the settings affect the image on a running deployment, then return to the Flow builder or tunables to adjust the coefficients until curved lines in the real world appear straight.
Inputs
| Name | Type | Description |
|---|---|---|
| image | image | The distorted original image. |
Outputs
| Name | Type | Description |
|---|---|---|
| undistorted_image | image | The resulting image with lens distortion removed. |
Parameters
| Parameter | Default | Valid values | Tunable |
|---|---|---|---|
| K1 | 0.0 | float | ✅ |
| K2 | 0.0 | float | ✅ |
| K3 | 0.0 | float | ✅ |
| K4 | 0.0 | float | ✅ |
| Post-undistort scale | 1.0 | > 0.0 – 2.0 | ✅ |
K1
Primary radial distortion coefficient. This has the largest visual effect and corrects the most common barrel or pincushion distortion. Negative values correct barrel distortion (edges bow outward); positive values correct pincushion distortion (edges bow inward). Typical values range from -1 to 1 (including decimals).
K2
Secondary radial distortion coefficient. Provides finer correction on top of k1, particularly at the edges of the frame.
K3
Tangential distortion coefficient (corresponds to OpenCV's p1). Tangential distortion occurs when the lens is not perfectly centered or aligned with the image sensor — instead of symmetric bending around the center, the image gets slightly skewed or stretched unevenly. In most industrial setups this value is close to zero.
K4
Tangential distortion coefficient (corresponds to OpenCV's p2). Works together with K3 to correct the uneven skew caused by lens-to-sensor misalignment.
Post-undistort scale
Zooms the image in or out after undistorting. Undistortion sometimes leaves black areas where the distorted pixels used to be. Values greater than 1.0 zoom in, which crops away those black borders. Values less than 1.0 zoom out, preserving more of the original field of view but potentially introducing black areas at the edges.
Example
Correcting barrel distortion on a PCB inspection camera
A wide-angle camera used for PCB inspection introduces barrel distortion, causing the board edges and reference grid to bow outward. The node is configured with a negative K1 to straighten the image.
Configuration:
- K1:
-0.25 - Post-undistort scale:
1.05


Result: The grid lines that were visibly curved in the input now appear straight, and the PCB boards regain their correct rectangular shape.
Related links
External:
- Distortion (optics) — background on lens distortion types
- OpenCV camera calibration tutorial — how undistortion works under the hood
Reference:
- Resize Image — resizing the output for display
- Crop Image — trimming edges after undistorting