Calibration is one of the most important step in the process : withouth well calibrated cameras, we can't reconstruct the scene in 3D. We must have exact data, that's why we have to take a lot of shots, to compute each camera's parameters.
There is two kind of data : Intrinsic Data, and Extrinsic Data.
The intrinsic matrix is computed with ~10 shots of the chessboard, covering the whole scene. The shots can be independant between cameras.
The extrinsic matrix is computed with only 1 single shot of the chessboard, which must be viewed by all the cameras : that allows us to compute the positions and rotations of the cameras in the space.
These 2 steps are made with MatLab. We use TOOLBOX_calib, available here. We have implemented a little "ad hoc" MatLab program to export data in a file in the format the server can use, implemented in CheapMocapCalib.m. Just clic "export" and call the file "camera0" to be able to use it. It contains, in that order, the extrinsic translation vector of the camera then, its extrinsic rotation matrix coefficients and finally its 4 intrisic coefficients. all these data are sent to the server when the client is asked to.
The extrinsic coefficients give the coordinates of the chess board in the camera system. So we have to compute the positions in a common coordinates system.
The sytem change formula is :
After this manipulation, we got the extrinsic coodinates of the cameras in the chess board system.
We first wanted to have a "master camera" in wich all coordintes are expressed, but we had to deal with some weird problems. So we left the coordinates in the chess board system for instance.
Finally, we use the newly computed coordinates to draw the scene with openGL. See this section for more details.
How to calibrate:
To calibrate you will need a chessboard picture (an A4 format one is available in the toolbox archive but an A3 format is better). Then in front of each camera, you have to show the chessboard in different orientations. Nine snapshots are usually taken. Try to cover the entire space in front of the camera as shown:
To compute extrinsic and intrinsic parameters, first unzip the toolbox archive then launch MatLab. Write :"addpath '$your_toolbox_calib_absolute_directory' -end".
Then enter : "cd '$your_calib_image_directory'".
Now you can use "calib" function to begin the calibration.
Click on "images names" and follow the step. You should be show an image like the one above.
Now it's time for "Extract grid corners". Leave all values by default. And click on each corner of the chess board. (Caution: you will have to remember the order you clicked!). Enter the dimensions of your grid and continue with the other pictures.
When you're done with the pictures, click on "Calibration". The program will compute the first approximation of intrinsic parameters. You can sharpen the precision by using "Recomp Corners" (leave the parameters by default) and then click on "Calibration".
Now you need the extrinsic parameters. Take an image where all cameras see the chessboard and click on "Comp. Extrinsic". Follow the steps. To see how was your calibration you can click on "Show Extrinsic" and "Reproject on images".
Final step : exportation. Click on "Export Calib Data" write : "camera0". Then place the file in the CheapMocapClient directory.
hint: use the clear all command between each calibration if you use the same MatLab session to calibrate all the cameras.