GML MatLab Camera Calibration Toolbox

Contact person: Vladimir Vezhnevets (


This is a modification of the original Camera Calibration Toolbox for Matlab® by Jean-Yves Bouguet that adds automatic calibration object detection to the functions of the original toolbox. Please refer to his page for the complete documentation on the toolbox and also a tutorial on camera calibration (it includes general information about calibration, references and related links).


The original toolbox works on Matlab 5.x and Matlab 6.x (up to Matlab 6.5) on Windows, Unix and Linux systems (platforms it has been fully tested) and does not require any specific Matlab toolbox (for example, the optimization toolbox is not required). It should also work on any other platform supporting Matlab 5.x and 6.x.

The modified version was tested only with MatLab 6.5 and MatLab 7.0 on Windows platform (as this is the only version of MatLab available to the author), but should work with other version also. As this modified version contains MEX-files, they should be recompiled to work on other platforms. The source code can be downloaded lower in this page.


v0.31b Download GML Matlab Camera Calibration Toolbox 0.31      11.05.2005 Re-compiled and added correct OpenCV dlls 
v0.3b   Download MEX file sources for calibration toolbox 0.3          20.04.2005 Integrated reliability additions and modifications made by Philip Gruebele.
v0.23   Download GML Matlab Camera Calibration Toolbox 0.23      15.02.2005 Should fix 'Unable to load mex file...' problem.
v0.23   Download MEX file sources for calibration toolbox 0.23        26.02.2005 Now should be compilable. Also migrated to OpenCV 4a.
v0.22                                       31.08.2004 Bug fix from Carl Witty

See also

C++ Camera Calibration Toolbox
Recommendations for taking calibration photos
OpenCV calibration object detection

How to use

Basically, the same way, the original toolbox is used:

Download the camera calibration toolbox from the bottom of this page.
Store the individual matlab files (.m files) into a unique folder TOOLBOX_calib (default folder name).
Run Matlab and add the location of the folder TOOLBOX_calib to the main matlab path. This procedure will let you call any of the matlab toolbox functions from anywhere. Under Windows, this may be easily done by using the path editing menu. Under Unix or Linux, you may use the command path or addpath (use the help command for function description).
Run the main matlab calibration function calib_gui (or calib).
Then follow the instructions on the original toolbox page, except for the part where corner detection is performed.

At the beginning of the corner extraction stage the user is asked: "Do you want to use the automatic object detection?". If the automatic detection is selected, then user is asked for the number of squares along each direction (X and Y) of the checkerboard for each image. Usually, if the same object for each frame is used, you have to enter the number of squares only once for the first frame, and just press enter each time this question is asked for the upcoming frame. Then, automatic corner detection is attempted. If the automatic detection procedure fails - standard manual procedure from the original toolbox is applied.

Modifications description

A MEX-file dmCornerDetect.dll, cv.dll and three new m-files click_dm_calib.m, click_dm_calib_read.m and click_dm_calib_noread.m have been added to the distribution. The click_calib.m and click_calib_noread.m files were modified for the automatic detection code to be called.


Works only with with objects that have odd x even (or even x odd) number of squares (i.e 5x6, 7x8, 10x7, etc).

Please read our recommendations for taking calibration photos before starting a calibration procedure.

Also, not all the problems of the original algorithm were treated - the main problem that remains (as it appears to me) is contour detection and the polygonal approximation - it sometimes fails to recognize well-segmented squares as quadrangles.

Another thing is that I actually tested only on my images, so maybe my modifications won't help other people to do their calibration. If so - send me your image sequences, I'll try to tune up my method to work with them also.



Several image sets with 5x6 object can be downloaded lower:

example set 1
example set 2
example set 3