Implement a function to remove radial distortion from a given point in an image. This process is crucial in computer vision to correct for distortions introduced by camera lenses.
The concept of radial distortion arises when a camera's lens bends light rays, causing straight lines to appear curved. This distortion can be modeled using a polynomial expression, where the distorted coordinates xd and yd are related to the undistorted coordinates x and y through a distortion factor.
To correct for this distortion, we can use an iterative refinement process, such as Newton's method or fixed-point iteration, which refines an initial estimate of the undistorted coordinates until convergence. The steps involved are:
This technique is widely used in image processing pipelines.
undistort_point([0.4688, 0.4688], -0.1, 0.01)
[0.5, 0.5]
Start with distorted point xd=[0.4688,0.4688] and radial model r2=x2+y2, xd=xu(1+k1r2+k2r4) (applied similarly to y) with k1=−0.1, k2=0.01.
Assume the undistorted point lies on the same ray, so try xu=[0.5,0.5] and compute r2=0.52+0.52=0.5.
Compute the radial factor: 1+k1r2+k2r4=1+(−0.1)⋅0.5+0.01⋅0.52=1−0.05+0.0025=0.9525, and then the distorted coordinate: 0.5⋅0.9525=0.47625≈0.4688 (the small mismatch is corrected by iteration).
Using Newton’s method or fixed-point iteration, the algorithm refines this guess until the forward distortion of xu matches [0.4688,0.4688], converging to the undistorted output xu=[0.5,0.5].