tezvyn:

Lens distortion and camera calibration

AI-drafted, machine-checkedSource: interviewintermediate
WHAT IT TESTS

camera-model fundamentals.

OUTLINE

radial distortion bends straight lines (barrel/pincushion), tangential comes from lens-sensor misalignment; calibrate with a known pattern to estimate intrinsics and distortion coefficients.

WHAT THIS TESTS The interviewer wants to know whether you understand that real lenses deviate from the ideal pinhole model and how the deviation is measured and corrected.

A GOOD ANSWER COVERS The two main families. Radial distortion bends straight lines because magnification varies with distance from the optical center; barrel distortion bows lines outward and pincushion bows them inward, and the effect grows toward the image edges. It is captured by radial coefficients, often called k1, k2, k3. Tangential distortion occurs when the lens and image sensor are not perfectly parallel, modeled by coefficients p1 and p2. Together with the intrinsic matrix, focal lengths and principal point, these describe how 3D points project to pixels.

COMMON WRONG ANSWERS Mentioning only radial distortion. Forgetting the intrinsic parameters entirely. Believing a single image can solve for all parameters, when many views are needed for a stable solution.

LIKELY FOLLOW-UPS Why do you need many images at different orientations. What is reprojection error and how do you use it. How does undistortion mapping use interpolation.

ONE CONCRETE EXAMPLE A standard calibration workflow uses a printed checkerboard of known square size. You capture twenty or more images of the board held at varied angles and positions across the frame. For each image you detect the inner corners precisely. Because the real-world geometry of the board is known, you can solve a system that yields the camera intrinsic matrix and the radial and tangential distortion coefficients, while also recovering the board pose in each shot. You evaluate quality by reprojection error, the pixel distance between detected corners and corners predicted by the recovered model; a low error means a good fit. Finally, you precompute an undistortion map, a per-pixel lookup that says where each output pixel samples from the distorted input, and apply it with interpolation to every incoming frame so straight lines in the world appear straight in the corrected image. This map is computed once and reused for the fixed camera and lens.

Read the original → docs.opencv.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.