Russian
Graphics & Media lab
Eng > Research > Camera Calibration > OpenCV calibration object detection
[Home]
[Researh]
[Library]
[Publications]
[About us]
[Links]
Hosted sites
[GraphiCon]
[Courses]

Vezhnevets Vladimir aka Dead Moroz
<vvp@graphics.cs.msu.ru>
Moscow State University
Graphics and Media Lab.

OpenCV calibration object detection

News

11.10.2005
  Recently, our code was integrated in new OpenCV release (OpenCV 5). And we are now testing another algorithm of calibration object detection, integrated in our new C++ calibration toolbox (see link below).

Downloads

v0.6b sources zip20.04.2005Integrated reliability additions and modifications made by Philip Gruebele. Should become more robust. Many thanks to Philip!
v0.5 sources zip17.11.2004Migrated to OpenCV 4a
Attention! cvConvertImage function in HighGUI096.dll has a strange bug (as I regard it), resulting in failure of CvImage to load itself in grayscale mode. Due to this I include my own (corrected) HighGUI096d.lib and HighGUI096d.dll into GUITest project.
v0.41 sources zip31.08.2004Bug fix from Carl Witty
v0.4 sources zip21.06.2004First release

See also

C++ Camera Calibration Toolbox
Enhanced Matlab Camera Calibration Toolbox

Introduction

An enhanced algorithm for corner detection for OpenCV is proposed. It works only for non-symmetric calibration objects (number of squares along one of the sides should be even, other should be odd) and:
  1. is able to determine the origin point among calibration pattern corners without ambiguity;
  2. is more robust (I hope) to cluttered background and checkerboard-like objects in sight;

Requirements

The code was written for OpenCV v 3.1b and was tested mostly on win32 (Win2K, WinXP) platform. It also was compiled and tested (though much less) on Mandrake Linux 9.0. It should also work on any other system supporting OpenCV 3.1.

How to use

The distribution package consists of three parts:

  1. the corner detection code itself (in the calibinit/ folder)
  2. two example applications (in the apps/ folder)
    1. an automatic self-test application (apps/autotest)
    2. a simpistic test GUI application (apps/guitest)
  3. the test data used by the self-test application (in the testdata folder)
The package includes doxygen-generated documentation. To use the corner detection algorithm in your application you can add the files from the calibinit/ folder to your project (or build them as a separate lib, if you like it better). The dmFindChessBoardCornerGuesses function has basically the same interface, as the cvFindChessBoardCornerGuesses and can be used instead of standard OpenCV function. The only difference is in_bAdaptiveThresh parameter which tells whether to use local adaptive thresholding or not.

For the sources to compile successfully, the include path should contain:

OpenCV/cv/include
OpenCV/cv/src
and library path should contain
OpenCV/lib

The testing applications will also require

OpenCV/otherlibs/highgui
to be added to the include path.

Modifications description

The OpenCV calibration pattern detection algorithm consists of these steps:
  1. Image binarization by thresholding to segment black and white squares
  2. Find corners of the black squares:
    • Find contours of the boundaries of the black regions
    • Select contours of suitable shape
    • Approximate these contours with 4-vertex polygons
    • Among these select the quadrangles resembling calibration pattern squares
  3. Extract corners of the selected quads, having at least one corner in vicinity
  4. Group and the corners of the selected quadrangles in lines according to calibration object size
Practically all the steps have their weaknesses:
  • Image binarization threshold is chosen according to global image statistics, which is not alwasy successful at segmenting black squares of the checkerboard.
  • The selection of quad contours of the black squares is not enough - it is able both to first and second type of errors
  • The condition of corners selection is too weak - false detection occurs too often
Actually, the steps 1, 3 and 4 were rewritten. What was achieved - the algorithm is now:
  1. more robust to global illumination effects (in segmenting black squares from white);
  2. able to determine the origin point among calibration pattern corners without ambiguity;
  3. more robust to cluttered background and checkerboard-like objects in sight;

Limitations

  1. Works only with with objects that have odd x even (or even x odd) number of squares (i.e 5x6, 7x8, 10x7, etc).
  2. All the squares must be clearly visible (unoccluded).
  3. The white space (marked with red on the picture below) between the outer squares and the object boundary should be at least 1 square wide, like this:
  4. 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.

Examples

Several image sets with 5x6 object are included into the distribution package. Load them into GUITest application and see what happens.

example set 1
example set 2
example set 3

Contacts

Please mail all comments, suggestions, problems and contributions to Vezhnevets Vladimir
<vvp @ graphics.cs.msu.ru> (remove spaces from the address before sending).

Graphics & Media lab (webmaster@graphics.cs.msu.su)