3 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
\r
4 <META NAME="GENERATOR" CONTENT="Microsoft FrontPage 4.0">
\r
5 <TITLE>Camera Calibration Tool</TITLE>
\r
6 <!-- Changed by: Jean-Yves Bouguet, 31-Dec-1999 -->
\r
8 <BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000CC" VLINK="#0000FF" ALINK="#FF0000">
\r
14 <table border = 3 WIDTH="70%" >
\r
19 <CENTER><TABLE CELLSPACING=0 CELLPADDING=5 WIDTH="90%" BGCOLOR="#6A9BED" NOSAVE >
\r
22 <CENTER><I><FONT COLOR="#000000"><FONT SIZE=+4>Camera Calibration Tool</FONT></FONT></I></CENTER>
\r
40 <CENTER><IMG SRC="pict_calib.jpg" HEIGHT=600 WIDTH=990></CENTER>
\r
45 The camera calibration tool lets you calibrate any video camera very accurately
\r
49 The user presents a flat checkerboard pattern in front of the camera,
\r
50 and the program automatically acquires a number of images and uses them
\r
51 to compute the intrinsic camera parameters (focal length, principal point,
\r
52 distortion coefficients) as well as the extrinsic parameters (3D position
\r
53 of the pattern for each image).
\r
55 Since the corners of the pattern are located automatically on each image,
\r
56 the entire procedure is fully automatic. Once calibration is done, the
\r
57 program lets you undistort the video images in real time (at frame rate).
\r
58 The lens distortion model consists of two terms: a radial distortion term
\r
59 (up to the fourth order) and a tangential distortion term (two scalars
\r
60 for encoding the angular orientation of the focal plane with respect to
\r
61 the sensor plane). Consequently, the lens distortion model is parameterized
\r
62 using four scalar coefficients.
\r
64 A complete tutorial of the algorithm with matlab code is provided, see
\r
65 <A HREF="#Tutorial">Tutorial Section below</A>.
\r
68 DirectShow Filter Application
\r
70 Note that this filter requires that you have DirectShow 6.0 or greater installed
\r
71 with <B>graphedt.exe </B>(DirectShow 6.0 for NT4.0, DirectShow 7.0 for
\r
73 (<A HREF="http://www.microsoft.com/downloads/release.asp?ReleaseID=16927">http://www.microsoft.com/downloads/release.asp?ReleaseID=16927</A> ~128MB[!]).
\r
74 You will also need a video camera source filter which should
\r
75 be supplied by your USB camera vendor. <!-- except most don't support NT4.0. -->
\r
76 <!-- %%Some friendly advice from Uncle Gary?? -->
\r
77 <!-- Win2000 is your best bet for development, for just running the filter graph, Win98 will do.. An example filter graph is shown below (with the calibration filter processing a video source from a Matrox Meteor II card that we wrote ourselves) and then passing the output to a video renderer. -->
\r
79 Microsoft* Windows* 2000 may be the most suitable operating system
\r
80 for development since many vendors do not supply filters for
\r
81 Windows NT 4.0. However, Windows 98 will be adequate for just
\r
82 running the filter graph
\r
84 An example filter graph is shown below. It is running our own
\r
85 calibration filter that processes a video source from a Matrox
\r
86 Meteor II card and then passes the output to a video renderer.
\r
89 <CENTER><IMG SRC="CalibFilterGraph.png" HEIGHT=210 WIDTH=601></CENTER>
\r
91 <a name="properties">
\r
92 <br>Right clicking on the CalibFilter brings up its property control page
\r
98 <CENTER><IMG SRC="CalibFilterLabled.png" HEIGHT=284 WIDTH=384></CENTER>
\r
103 <B><FONT SIZE=+2>[1]</FONT></B> Enter the
\r
104 number of columns (Squares per row)in your calibration checkerboard.
\r
105 Click "Apply" [12] to enter.<br>
\r
107 <B><FONT SIZE=+2>[2]</FONT></B> Enter the
\r
108 number of rows (Squares per column)in your calibration checkerboard.
\r
109 Click "Apply" [12] to enter.<br>
\r
111 <B><FONT SIZE=+2>[3]</FONT></B> Actual
\r
112 size of squares in your calibration checkerboard (in whatever units --
\r
113 say cm). Click "Apply" [12] to enter.<br>
\r
115 <B><FONT SIZE=+2>[4]</FONT></B> Start automatic
\r
116 collection of calibration frames.<br>
\r
118 <B><FONT SIZE=+2>[5]</FONT></B> Save current
\r
119 set of calibration parameters to disk.<br>
\r
121 <B><FONT SIZE=+2>[6]</FONT></B> Load previously
\r
122 saved calibration parameters.<br>
\r
124 <B><FONT SIZE=+2>[7]</FONT></B> If you've
\r
125 just calibrated the camera, or have loaded [6] previous calibration parameters,
\r
126 checking this box causes the computation of the undistorted image in real
\r
127 time. If this box is not checked, the raw video frames are displayed.
\r
128 You must click "Apply" [12] to register the check.<br>
\r
130 <B><FONT SIZE=+2>[8]</FONT></B> Checking
\r
131 this box causes an OpenGL display to show the tracking of the calibration
\r
132 checkerboard. You must click "Apply" [12] to register the check.<br>
\r
134 <B><FONT SIZE=+2>[9]</FONT></B> Set how
\r
135 many frames of the calibration checkerboard you want to collect before
\r
136 performing calibration (between 10 and 20 is usually enough, use more only
\r
137 if high accuracy is desired). Click "Apply" [12] to enter.<br>
\r
139 <B><FONT SIZE=+2>[10]</FONT></B> Set how
\r
140 number of miliseconds of delay between collecting frames of the calibration
\r
141 checkerboard when you start [4] calibration. This allows you as much
\r
142 time as desired to move the calibration checkerboard around the video scene
\r
143 before the next frame is taken during calibration. Click "Apply"
\r
146 <B><FONT SIZE=+2>[11]</FONT></B> The current
\r
147 calibration parameters are displayed in this box.<br>
\r
149 <B><FONT SIZE=+2>[12]</FONT></B> You must
\r
150 click "Apply" after setting any or all of [1], [2], [3], [9] and/or [10].
\r
160 <B>(a)</B> Get or make a black and white checkerboard calibration object
\r
161 as shown in the images above or animated gif's below.
\r
162 <BR><B>(b)</B> Enter the number of columns ("squares per row") in [1] and
\r
163 number of rows (squares per column) in [2]; Enter the size of a square
\r
164 <!-- %%Whatever units? -->
\r
165 in whatever units in [3] (optional) ; Enter the number of frames that you
\r
166 want to collect in [9] (10-20 usually suffices); Enter the minimum time
\r
167 between capturing frames to allow you time to move the calibration object.
\r
168 <BR><B>(c)</B> Click "Apply" [12].
\r
169 <BR><B>(d)</B> Click "Start" [4].
\r
170 <BR><B>(e)</B> Move the checkerboard around. The number of frames
\r
171 collected will display in [11]. When all frames are collected it will solve
\r
172 for the calibration parameters and display them in [11].
\r
173 <BR><B>(f)</B> Checking [7] followed by clicking "Apply" [12] causes the
\r
174 rectified video image to be displayed as shown in the second example below.
\r
176 <br><br>Notes: When calibrating, the video image flashes when a frame is captured.
\r
177 It won't capture unless the colored lines are drawn on the checkerboard
\r
178 as shown in the examples below. You must move the calibration object
\r
179 around -- if your views are too much alike, you will get an ill-conditioned
\r
180 matrix with resultant divide by zero when the filter solves for the camera
\r
181 calibration parameters.
\r
184 Save calibration parameters to a file:
\r
186 <B>(a) </B>Click "Save" [5] and a dialog box will prompt you for
\r
187 saving the calibration parameters under a text file. Click this
\r
188 <a href="cam_model.htm">link</a> for information on the camera model, and the content of the text file.
\r
191 Load previously stored calibration parameters:
\r
193 <B>(a)</B> Click "Load" [6] and a dialog box will allow you to select
\r
194 a calibration parameter file.
\r
195 <BR><B>(b)</B> Calibration parameters will appear in [11].
\r
198 Turn image rectification on and off:
\r
200 <B>(a)</B> On: Check the "Undistortion" box [7]. Click "Apply" [12].
\r
201 <BR><B>(b)</B> Off: Un-check the "Undistortion" box [7]. Click "Apply"
\r
205 Turn the 3D OpenGL window on and off:
\r
207 <B>(a)</B> On: Check the "Show 3D window" box [8]. Click "Apply" [12].
\r
208 <BR><B>(b)</B> Off: Un-check the "Show 3D window" box [8]. Click
\r
214 The following movie shows the 3D pose of the calibration object being computed
\r
215 in real time after the camera has been calibrated.
\r
218 <CENTER><IMG SRC="calibration_shot.png" HEIGHT=253 WIDTH=528></CENTER>
\r
222 The next picture shows image undistortion performed by the filter.
\r
225 <CENTER><IMG SRC="undistortion_shot.png" HEIGHT=226 WIDTH=721></CENTER>
\r
228 <A NAME="Tutorial"></A>Tutorial and calibration toolbox</H1>
\r
229 In addition to the <A HREF="../../ref/OpenCVRef_3dReconstruction.htm#ch6_calibration">
\r
230 OpenCV implementation</A> of the calibration functions and tool, we provide a complete
\r
231 tutorial and calibration toolbox for MATLAB. It can be downloaded from
\r
232 <a href="http://www.sourceforge.net/projects/opencvlibrary">OpenCV page at Source Forge</a>
\r
234 <hr noshade size=2 width=100%>
\r