How to calibrate camera with OpenCV

When using MYNT EYE camera first time, the SDK will download a calibration file for this camera to "settings/SN*.conf".

Besides, the SDK also provides a stereo_calib tool to help calibrate camera with OpenCV by yourself.


$ ./tools/stereo_calib -help
Stereo calibration with square chessboard.
Calibrate the stereo camera and display rectified results along with the computed disparity images.
Chessboard pattern which has a size of 9 X 6:
./stereo_calib -w=9 -h=6 -s=1.0 [-nr] [-n=12 -i=1] <image list>
Default Description
-help show help message
-w=<board_width> 9 number of inner corners per a chessboard row
-h=<board_height> 6 number of inner corners per a chessboard column
-s=<square_size> 1.0 the square side length in real measurement
scale the vectors of the calibration pattern points
-nr not display rectified results
-n=<image_number> 0 capture images manually if greater then 0
stored into `./images` directory
-i=<device_index> 0 device index, but default is MYNTEYE on Windows
`./tools/list_devices` to see indexes on Linux/Mac
<image list> ./stereo_calib.xml given images in a XML/YML file


  1. Prepare a calibration board with square chessboard.
    • Could print a chessboard pattern and paste it on a board which had better be flat and hard.
  2. Plug the camera in a USB 3.0 port.
  3. Run stereo_calib to calibrate camera.
     # Manually capture `12` images of device `1`, then calibrate.
     $ ./tools/stereo_calib -w=9 -h=6 -s=25 -n=12 -i=1
     # Using captured images in `images/imagelist.yaml` to calibrate.
     $ ./tools/stereo_calib -w=9 -h=6 -s=25 images/imagelist.yaml
    • If not sure which index is MYNT EYE, you could run ./tools/list_devices.
    • If not -nr option, you will preview rectified results after calibration done.
      • Press space to next or esc to exit.
  4. The calibration file will be saved to "<MYNTEYE_SDK_ROOT>/settings/SN*.conf".