tclcalib - A tool for camera calibration

maintained by James Davis


What is included

This tool is really a collection of a bunch of smaller tools all wrapped up together in order to make internal camera calibration easy. In theory external pose is solved as well, but I only use it for internal myself. In particular there are these parts:

At the core is Janne Heikkila's calibration toolbox. However everything has been compiled and integrated so that it is hopefully easier to use. 


Download - A large 18MB zip archive of everything, plus maybe some stuff you don't need. 




This was originally a bunch of individual tools under IRIX, with a tcl/tk wrapper that called everything so that I didn't have to remember the exact recipe to follow. I think it should be possible to make it work under other unix flavors but I haven't tried. Also you'll need to have all the right support applications installed.


In order to make it more usable by other people I have munged it all into a distribution that includes everything you need to run under Win2K. I've compiled both the matlab and tcl into executables for Win2K so that you don't need to have either installed.


Other calibration tools

Janne Heikkila's Camera Calibration Toolbox  (on which this tool is based)

Rather than list them all myself, I refer interested parties to an annotated list maintained by Jean-Yves Bouget. He has a fine matlab calibration toolbox himself, as well as C implementation available.


Only the Win2K installation is described, for IRIX all the parts are included but no instructions.

Easy installation

  1. If SGIs IFL library has not been installed on your machine, then install the libraries in IFL1_3_1.exe. Unfortunately, just copying DLLs around does not seem to work, you must actually install the libraries using their installer, as Administrator on your machine. This is freely available from the SGI web site, but I've included it for convenience, and to insure that the same version is used.
  2. Make sure the directory 'pc_tclcalib_complete' is in your path. You don't need any of the other directories to run under Win2K, they contain source for the various tools that make up the package. You can delete them if you want to.

More detailed installation

The directory pc_tclcalib_complete has a relatively small amount of stuff that is actually part of this package. The rest of the mess is all the support executables and surrounding DLLs. Its all been included in the easy installation above to make it easy for people to get this running. If you already had a machine set up for development you might be able to keep just the smaller set, since everything else may be installed elsewhere on your machine anyway. Except matlab, all the external tools are free on the net.

The following executables are included in pc_tclcalib and must be in your path:

These scripts make use of the following external things, all of which need to be in your path:



Easy Usage

  1. % cd calib/testdata
    % calib image1.tif [image2.tif] [image3.tif] 
  2. You should see something like this (but with no image yet)
  3. Select the image to start with - (click on image1.tif)
  4. Click on 'Find Dots' (now the image should appear)
  5. Repeat for image2.tif and image3.tif
  6. Highlight the desired images to use for calibration (select all of the images)
  7. Click 'Calibrate'
  8. Note in the console information about the quality of calibration
  9. Click 'Quit'
  10. Calibration results are in 'camera.fin'

GUI Components

Command Line Usage To Calibrate Internal Parameters

We can calibrate camera internal parameters using the above gui or with the following command line routines.

% hough 6 6 10 10 100 image1.tif
% match2ideal image1.tif_points 65 6 > image1.match
% hough 6 6 10 10 100 image2.tif
% match2ideal image2.tif_points 65 6 > image2.match
% match2fin camera . image1.match image2.match

Command Line Usage To Calibrate External Parameters

Suppose we have a set of xyzuv data. That is image plane observations (uv) related to actual world 3D coordinates (xyz). The *.match files generated by the above procedure have this information, but you may also have obtained it via some other method. You may or may not have bothered to obtain a set of internal calibration parameters. You can use one of the following two commands to obtain a camera calibration file with both internal and external calibration.


Interpreting the calibration data

The produced file camera.fin has the following numbers in it.

640.000000  # NDX - [pix] number of pixels in x direction
480.000000  # NDY
6.384000    # Sx - effective CCD chip size in horizontal direction
4.804800    # Sy - 
0.963191    # Asp - aspect ratio
5.939386    # Effective focal length
353.051566  # Cx - [pix] principal point
245.274074  # Cy
-0.006705   # Rad1 - lens distortion parameters
0.000157    # Rad2
0.000786    # Tan1
-0.005542   # Tan2
-0.032590   # Inverse lens distortion parameters
-505.7523   # Tx - [mm] Extrinsic parameters
109.213337  # Ty
995.917779  # Tz
-170.885852 # Rx [rad]
-2.951705   # Ry
-6.014927   # Rz

What is in all these directories?



Heikkila and Silva - The main calibration code is from their toolbox.

Szymon Rusinkiewicz, Kari Pulli, and Alex Roetter - The hough code was at one point touched by each of these guys. smr also wrote some of the perl munging stuff.

Xing Chen - The C++ classes that can read these calibration files, as well as some of the matlab wrapper code was written by Cindy.

Matt Pharr, Maneesh Agrawala, Chris Stolte - The C++ code uses a matrix library called sgl that was written by Matt, and then made to work under visual studio by either Maneesh or Chris.

Dennis R. LaBelle - Wrote FreeWrap, which is a nice way to wrap up tcl so that there doesn't need to be an actual full tcl  installation on the target machine.

Bits and pieces from SGI, Mathworks, ImageMagick, and Cygwin.
(I don't think I've included anything any of these people are trying to sell.)