Inherent in most imaging device is the presence of diffraction and aberration due to the finite collection aperture and geometry of the lens. Because of the shape and composition of the lens (i.e spherical), magnification and focusing is not isotropic resulting to unwanted distortions. Two of the most common distortions are pincushion and barrel distortion (fig 1).
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3MKsJYoGWfPjYmFyDJNPELAvTnRhXgBbp1tVB-kUgQgwKbN8fnhfPT_KwFQUiik72pmlrmlE5L34JpA0KqOp7S8WNyn_TbT9BkxF_aE58fD86o5BigVKSboNSTF1QYUaniy0beVqCSEI/s400/distortion.png)
Distortions are usually undesirable in image processing especially in machine vision where slight distortions have major drawbacks [2]. Intuitively, a distorted image is the result of a transformation from an ideal image. Essentially, the process in correcting image distortion is to find the transformation from the ideal image to the distorted image.
Using a reference grid, we can correct image distortion as follows:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqqmFjBacVSXKKXkDDHO2xncvZNrHYimaFLiUf_TW27Buw5Xr0ZTJ_6lfNErVtPNnuecBj8G8ZYD1DlmwqoXxiCTdT-WqdN9UL51Q00HgP-JbC0H1OitjLIarPz49zMR6_Cly2WeJoEg4/s400/formula.png)
Consider fig 2, given the coordinates (x,y) of an ideal image (i.e., reference grid) we can find the distorted image coordinate x',y' using the transformation r, s by finding the coefficients c1-c8. The problem now reduces to solving systems of equation with eight unknown, c1-c8 (see fig 3). The eight equations can be obtained from the coordinates of the vertices (four corners) of the grid. It must be noted that the transformation is only valid inside the grid and the coefficients must be recomputed for a different grid.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6v32M0Iy68f0l9Wsg99uYG48phv3ayupQ-S93N84hQTXw1_tgIaaxJ2tp8Nm2PhiNP2oUxSRqeEm4QjyXctrXP3SlNmd16ZtreWqdjyzS2coXQNAYDT8lzjwGcv95Kq_UKdRLYU0-vwM/s400/transformation.png)
Per pixel in the ideal grid, we can find the corresponding distorted coordinate r,s using the computed coefficients, c1-c8 (fig 2).
After finding the corresponding distorted coordinate, we have to find the graylevel value of the ideal image. If the computed distorted coordinate is integer valued, we just have to carry the graylevel value of the distorted image to the ideal image otherwise we have to interpolate. We use two kinds of interpolation, nearest neighbor and bilinear interpolation.
The nearest neighbor interpolation uses the graylevel value of the nearest integer-valued coordinate in the distorted image. This kind of reconstruction is very fast but the quality is poor and is ideal for thumbnails and images with relatively not varying graylevel value. On the other hand bilinear interpolation assumes linear interpolation in both directions simultaneously similar to what we did above. The graylevel value v can be obtained as follows (fig 4).
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNs7ovfrJTIac1MDyZyXHVi0-w7muosNS4UFqB3Ww9i-helnvzvXssG-Ixw9zD5uLhZ0oDdF338-qFzpJn7UfUgfT0UDfzsy-tXeuPZw9415sdJzD0fQkEQVi4pqG0qwum0w7gBEkSbgE/s400/bilinear.png)
Below is the result of the reconstruction using checkerboard and a distorted image of a window for nearest neighbor interpolation. To find the reference grid coordinates of the distorted image, scilab's locate was used to manually obtain the data points. Although this is very taxing, locating reference grid coordinates embedded with images is sometimes a formidable task. It is highly recommended though to obtain the coordinates using image processing techniques.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIG_xKdvp7Nz1LwlTk-EE4dx4IADoFtDMT4UGSXOWREntXZNtdpAsDuF8nwOvvDr0MDOmKxjLgVl3XghWbv6VTNDco1OEuRJ-cWUqdUp6Upn1Jt3EdrSw9qQ6PSDjRSXJvuaJUXwM7E14/s400/nearest_checker.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNg2bzd5pftlWJROHTFMTbxC54lmEJ66Dg-NceE9iMCxuKWECKuE4xj-SdA3O-qH1hMwxtY1qzaLY5msz4Jxp0c7bZjIL_ZsKh4fkFlQz4kCigI_Fm5eGB-lGccZALkGLgkOKM9nax360/s400/nearest_window.png)
For the checkerboard, nearest neighbor interpolation is already acceptable since the image is only black and white but for the window, the details of the image was slightly diminished and we need better interpolation scheme.
In bilinear interpolation, the quality is better compared to the nearest neighbor scheme but the speed is very much slower, figure 6 shows this result.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinf-GVF6KXA1BV830fjmftkDDt65JP47zglvqys00Peh9HSnU3ENBnCPMFVChhpJBo98RL5B1lSbHQwQVImEipEyjH8Z9ejahCvroQPWbyxld-qLC-00gBkrAhAFNtmGxWL37t5R-s6k8/s400/bilinear_checker.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEio2REvzO7crTDoThxxXJpl82RIi8gDnInuT7V2Ym5mG_lElCx-bn8dQFt9GjqysJ307LkkPnGhRKLg_yop-BXOh8WLrBVdTRP9u7_ulQgRJ-RDTsDi2dO11Ql9nbiORQJj9mMtVLdlYk8/s400/bilinear_window.png)
In this activity, I give myself a grade of 10 for correcting the distortion thereby achieving the goal of the activity.
I would like to acknowledge Mark Jayson Villangca, Jay Samuel Combinido and Luis Buno for all the help and jokes in doing this activity.
References
[1] http://en.wikipedia.org/wiki/Image_distortion
[2] Applied Physics 186 manula (c)2008 Maricor Soriano
No comments:
Post a Comment