Introduction - If you have any usage issues, please Google them yourself
Camera calibration code, OpenCV does not provide a complete example of his order a bit, posted record. Use cvFindChessboardCorners find board in the camera' s 2D position, then cvCalibrateCamera2 calculate internal reference, and finally to correct the image distortion with cvUndistort2.