Sunday, September 6, 2009

Activity 13 - Correcting Geometric Distortions

Images captured by digital cameras sometimes are sometimes distorted due to the lens. In this activity, we are to correct an image which has a barrel distortion.

To correct distortion, we need a reference image with a regularly occurring pattern such as a grid so that we can visualize distortion across the image frame. Consider the vertices of a distorted and ideal image of part of a grid:

where g(x^,y^) is the distorted part and f(x,y) is the ideal part. The transformation function that maps the pixels from f(x,y) to g(x^,y^) is given by:

The transformation function is guessed to have a form of:

Using bilinear interpolation, the graylevel v of a pixel in a certain location is given by:
The four equations needed to find the four unknowns (a,b,c,d) may be formed from the four nearest pixels surrounding the point (x^,y^) as shown below:

The coefficients are computed using by manipulating the matrix equation below:
The calculated coefficients will then be used to compute for the location of a point in the ideal rectangle in the distorted image using the equation:

and the interpolated grayscale image is calculated using
For this activity, I will used the distorted image below:


The ideal grid points were generated by measuring the grid box in the middle and replicating for the whole image size, shown below:

0 comments:

Post a Comment