### Distortion Correction

The calibration algorithm used in Photo3D assumes camera to be an ideal pinhole model. However actual cameras are different from that by the error caused by lens distortion. An example of extreme case is fish-eyed lens. Usual cameras also include  more or less amount of the fish-eye distortion. And it affects on the dimensional precision of the 3D model created by our method.
Fortunately there is a concise mathematical model, where the distortion is described using only one parameter, called "distortion coefficient". And it gives practically good approximation. Roughly speaking, the parameter can be thought as the "degree of fish-eyed". An image taken by a fish-eyed lens has a big value of the distortion coefficient. On the other hand one taken by an ideal pinhole camera has distortion coefficient zero.
We cope this problem by estimating the value of distortion coefficient, and correct the original image in advance according to the estimated parameter.

#### Estimating the distortion coefficient main window This image is taken by a usual camera with  zooming mechanism. Estimated angle of   vertical field of view  is 60.3 degree. Choose a line in the image for reference, which is used to estimate the coefficient value. The criteria of choosing are:  the longer the better the farther from the center of image the better Activate the "Stretcher Window", which is an auxiliary window where a thin rectangular portion of the original image is mapped  into a square by an affine transformation. The Strecher Window enables you to recognize the slightest distortion by exaggeration.  In the image on the left, you can see a thin rectangle bounded by blue lines, and center line in red. By pick and drag adjust the end points of the red axis to those of the chosen line in the image. Strecher Window In the Strecher Window an edge of the building is displayed as a curve, while the red axis is drawn in straight line because the distortion coefficient is set zero by default. regulated axis Regulate the value of coefficient so that the red line is distorted to fit the chosen line in the image.  The red curve means that  if the distortion coefficient is as indicated by operation, straight line in the real world should be taken into the photo as the red curve. Thus we have estimated a value of the coefficient. corrected image By invoking the correction function, we get the corrected image in the Strecher Window. corrected full image And also in the main window. Thus we have got a steady start point to work.