# 2012_0614 Distortion

The objective of this work is to study camera distortion using images of checkboard targets.

Download MATLAB source: source.zip and test images: images.zip The images are shown in `img_array`.

One approach is to use connected-components analysis to find the interior of checkers, and then sort them to a 2D grid of neighbors.

See `finder1` and `finder2` for examples of this approach. Some parameters must be adjusted for this method to work correctly.

Another approach is to use a "butterfly corner" detection filter to find the corners of the checker squares. We try to calculate the centermost square by looking for the four nearest neighbors to the centroid. This does not always work perfectly and guidance may be required to find this square. Next we extend the grid in all directions (left, right, up, and down). Where there is distortion you can easily see the difference between the grid and the actual corner location.

See `positions` for an example of this approach. The script `drawgrid` is used to draw the grid. The function `filters2` defines the filters.

### Further work

1. Capture more images that cover the entire field of view of the camera, in overlapping sections. The target board needs to be perpendicular to the optic axis of the camera.
2. The ideal algorithm is probably a combination of the two approaches given here. Both need work to make them more robust.
3. Work on the sorting algorithm to order the checkers into a 2D grid.
4. Draw vectors from the ideal grid coordinates to the actual grid positions. These vectors should point to the center of distortion symmetry (ideally the optic axis)
5. Work on the bow-tie detection filter so that it works no matter what the orientation of the bow-tie. See the exampe below for corners of various orientations.

6. Implement a distortion calibration algorihm to find the parameters of a suitable distortion model
7. Improve the preprocessing method to find checkerboards in arbitrary positions.

Maintained by John Loomis, last updated 20 June 2012