Boss New task, need to implement binocular algorithm on FPGA, so recently began to learn this piece, binocular algorithm is divided into 3 parts: calibration, correction, matching. In fact, the calibration is the most basic part, for the subsequent program to provide the initial data, this piece of data mainly refer to the image acquisition and Monocular calibration and camera calibrations and stereo calibration, this article is mainly my binocular calibration step and I understand this.
One, fixed camera
Camera this piece I use is two Logitech's ordinary USB camera, generally as long as the use of cvcreatecameracapture () function in OpenCV can capture the image is good. Then fix the two cameras in parallel, and my camera ends up as follows:
Second, use the camera to capture the calibration plate image in different directions
Once the camera is secured, the image is started, and the calibration board (my A4 Calibration board) is used to calibrate the next use of the MATLAB calibration Toolbox (click the Open link). When getting the image, it is necessary to pay attention to the need for two cameras to synchronize the acquisition, so that the calibration results will be correct. The idea of this algorithm can be referred to: simultaneous acquisition of images
Third, using MATLAB calibration Toolbox measurement Data
After the previous step, we get the image of the calibration board in many different positions on the left and right two cameras, and put the images in the Matlab Toolbox folder for processing. The processing method can be referred to: using the MATLAB Toolbox for calibration. Note that when extracting the first picture, the command line window may prompt you to enter the size of the grid, this must be based on the size of your calibration paper, if this error, the calibration of the data is problematic, I use the size of the calibration paper box is 15mm. Other follow the steps to do just fine, after the stereoscopic calibration, it is best to check the show extrinsics of stereo rig to see if two cameras are parallel, and finally get the following results:
The above is the camera parameter information, and then package the data into XML format, easy to use when correcting. The data used for the correction include the following: the reference data (focal length and origin coordinates), distortion, rotation matrix om and shift vector t.
For example: the camera reference Information format is as follows (left):
<?xml version= "1.0"? ><opencv_storage><cam_m2 type_id= "Opencv-matrix" > <rows>3</ rows> <cols>3</cols> <dt>d</dt> <data> 357.49543 0. 182.35795 0. 365.72798 193.12148 0. 0. 1.</data></cam_m2></opencv_storage>
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Binocular Vision Algorithm Learning (a): Binocular calibration