Straight lines that bow

A regular grid pushed through the distortion model a calibration actually estimates, with the corner displacement in pixels read out live. The overlay shows the corrected grid, which is the payoff calibration buys.

Try this

Move k1 negative for barrel, positive for pincushion, and note how little of the coefficient it takes to move a corner by ten pixels.

Try it: bend the lens

Where this lab comes from

Lens Distortion: Where the Straight-Line Model Actually Fails

Lesson 3 of the Image Formation unit. Real glass images the edges of the frame at a different scale from the centre, and the error climbs steeply with radius. Measured on OpenCV's calibration set: the top-left pixel of a 640x480 frame belongs 51.22 px from where the pinhole model puts it, and adding the Brown-Conrady terms drops the mean reprojection error of one view from 2.55 px to 0.170 px. Straightening it back costs field of view rather than pixels: 61.67 degrees becomes 67.32.

More in cameras and geometry