where x,y and u, v are point coordinates in the input and output images, respectively, N is the polynomial order, and a, b are mapping coefficients that characterize the transformation [Sch89
]. Typical choices for the mapping order are N=1, 2, 3. The lowest-order mapping, N=1, is known as a bilinear transformation and has the form
The bilinear transformation in Equation (4.3.3) is defined by 6 coefficients, the elements of matrix W. Given a minimum of three pairs of control points, the coefficients may be obtained by solving a system of linear equations. In the case when the number of control points exceeds the necessary minimum of , a pseudo-inverse solution returns coefficients that best approximate the true mapping function in the least-squares sense [Wol90
]. Subsequently, the coefficients may be used to compute the location in the x
plane of any point in the u
plane. Considering the latter to be the distorted image plane, and the former the domain of the undistorted original, this calculation in effect corrects for the distortion. Note, however, that calculation of point (x,y) using Equations (4.3.1), (4.3.2), or (4.3.3) will almost never result in a pair of integer values. In order to assign pixel intensities to points actually on the sampling (i.e.
, integer) grid, some interpolation strategy must be adopted. The two most common are nearest neighbor and bilinear interpolation. In bilinear interpolation, the pixel values at the corners of the square integer grid enclosing point (x,y) are weighted and averaged.
Here is an example of geometric warping and correction. We use the function ImageWarp
to first warp the geometry of the example image, so that it exhibits barrel distortion. Next we use the distorted image as the new input and reverse the distortion. We show the geometry of the two domains. The red grid lines represent the geometry of the undistorted image, while the blue lines are an example of barrel distortion.