Camera calibration using an algorithm proposed by Tsai. We use it to transform the image coordinates in world coordinates. More information about it can be found in his paper : "An Efficient and Accurate Camera Calibration Technique for 3D Machine Vision", Roger Y. Tsai, Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, Miami Beach, FL, 1986, pages 364-374." or on this website. The calibration code come from this website.
For a deformed image, TSAI is better than a purely linear second order calibration method. However, it is slower, and sometimes, when the camera axis is orthogonal the to setup plan, TSAI method can lead to error in computation and tremendous errors, and even crash of the method.
A good presentation of the parameters can be found here.
Path the XML file containing the calibration points. The file must have the following format:
<?xml version="1.0"?> <pointlist> <points> <point> <xworld>0.3</xworld> <yworld>0.9</yworld> <ximage>9.8</ximage> <yimage>10.3</yimage> </point> <point> <xworld>34.1</xworld> <yworld>7.9</yworld> <ximage>44.3</ximage> <yimage>25.9</yimage> </point> </points> </pointlist>
More points can be added in the same way as the two points in this example. A minimum of 5 non-collinear points is needed to compute the calibration.
[sel] Number of sensor elements in the camera's x direction.
[pix] Number of pixels in the frame grabber's x direction. If the calibration is crashing, put a value 5% smaller than the Ncx.
[sel] Number of sensor elements in the camera's y direction.
[pix] Number of pixels in the frame grabber's y direction. If the calibration is crashing, put a value 5% smaller than the Ncy.
[mm/sel] X dimension of camera's sensor element (in mm).
[mm/sel] Y dimension of camera's sensor element (in mm).
 Scale factor to compensate for any error in dpx. Use 1 by default.