Application of Self-Calibration-Stereo-PIV in Enclosed Measurement Volumes by B. Wieneke LaVision GmbH Anna-Vandenhoeck-Ring 19 D-37085 Göttingen, Germany E-Mail: b.wieneke@lavision.de ABSTRACT A major source of error in Stereo-PIV is a misalignment between calibration plate and laser light sheet. This can be corrected by a self-calibration procedure which computes the cross-correlation and disparity map between images of camera 1 and 2 recorded at the same time. From the disparity map the points of the light sheet in space are calculated by stereoscopic triangulation. Finally through all points a plane is fitted and the mapping function is transformed accordingly onto the light sheet plane. It has been shown that this method works accurately in air even for very large misalignments such that it is no longer required to closely align laser sheet and calibration plate. Test have been performed to validate the self-calibration for water experiments. It is shown that the camera pinhole model is flexible enough to compensate distortions when calibrating and recording in water. The question becomes if it is possible to calibrate outside the measurement volume and to correct the mapping function for the recordings done inside, because there are many PIV-experiments where it is difficult or even impossible to do an accurate calibration inside. Two different strategies are presented to cope with this problem. First one can do a calibration outside under similar optical conditions as inside together with the standard self-calibration procedure. Secondly the calibration is done outside in air and selfcalibration is done using a modified camera pinhole with a three-media model air-glass-water to account for different refractive indices. This has been verified by experiments with a random pattern plate moved by a translation stage. Residual errors in the computed 3C-vectors due to errors in the mapping function are below of what is expected from all other error sources. L L Fig. 1. Left: recording position. Middle: calibration procedure in similar optical setup outside. Right: calibration outside in air and self-calibration onto recording using 3 -media model. 1 1. INTRODUCTION For Stereo-PIV a correct calibration is an essential prerequisite for measuring accurately the three velocity components. Often an empirical approach is used by placing a planar calibration target with a regularly spaced grid of marks at exactly the position of the light sheet and moving the target by a specified amount in the out-of-plane direction to two or more zpositions (Soloff et.al. 1997). At each z-position (light sheet plane defined by z = 0) a calibration function with sufficient degrees of freedom is mapping the world xy-plane to camera pixel positions, while the difference between z-planes provides the z-derivatives of the mapping function necessary for reconstructing the three velocity components. This empirical approach has the advantage that all image distortions arising from imperfect lenses or light path irregularities e.g. from air/glass/water interfaces are compensated for in one step. Instead of moving a planar target in z-direction one can use also a 3D-calibration plate with marks on two z-levels e.g. spaced by 1 mm avoiding rigid mechanical setups with accurate translation stages. Different mapping equations have been used from a second-order or third-order polynomial in x and y to functions derived from the perspective equations (camera pinhole model) (Willert 1997). A major drawback of this empirical method is the need to position the calibration plate exactly at the same position as the light sheet which is sometimes very difficult. Misalignments between the calibration plate and the laser light sheet lead to different sources of errors. Ideally after dewarping each camera image with its own mapping function at z=0, the two dewarped images should overlap perfectly and the two 2C-vectors calculated in each dewarped image at world position x/y are used to calculate the true threecomponent vector by stereoscopic reconstruction. But if, for example, the calibration plate has a z-offset relative to the measurement plane the dewarped images have a slight offset and the 3C-reconstruction uses vectors computed at different locations in the measurement plane, which due to velocity gradients leads to considerable errors in the reconstructed 3C-vector. Willert (1997) has proposed a correction scheme based on a cross-correlation between the dewarped image of camera 1 and 2. For a perfect calibration the computed displacement vector map (‘disparity map’) is zero, any misalignments show up as non-zero disparities. So one can simply use the displacement vectors as a correction for the position of the two computed 2D-vectors, such that the two 2D-vectors are again computed at the same world x/y-position. This scheme works well for small misalignments correcting the main source of error arising from the two 2C-velocities computed at different positions. The mapping function derivatives are not yet fully correct and the coordinate system is still slightly warped and possibly rotated. A complete self-calibration correction scheme has been proposed by Fournel et.al.(2003), Fournel and Coudert (2003) and Wieneke (2003). First an accurate volume calibration is done which maps world points to camera pixel locations using a camera pinhole model. Then the disparity map is used to compute the true position of the light sheet relative to the calibration plate and the mapping function itself is changed accordingly. This leads to a correction of all misalignment errors and a correctly defined new coordinate system. This method is reviewed in more detail in the next section. It is shown that for measurements in air the self-calibration method can accurately correct even large misalignments, thus there is no longer the need to align calibration plate and light sheet. In the following sections it is examined if the camera pinhole model and the self-calibration method still works e.g. in water with air-glass-water interfaces with refractive index changes and secondly if it is possible to do a calibration outside a closed measurement volume and to use self-calibration to compute an accurate mapping function for the 2 measured light sheet inside. This would offer the possibility of Stereo-PIV for difficult experimental conditions, where it is complicated or even impossible to perform an in-situ-calibration inside the measurement volume. Different strategies are provided and tested with a random particle pattern plate which is moved by a translation stage. 2. STANDARD SELF-CALIBRATION METHOD Extensive work has been done in the field of computer vision and photogrammetry to accurately map points in space to camera pixel coordinates. Usually this is done by a camera pinhole model with added parameters for optical path distortions (Tsai 1986). One distinguishes between external (‚exterior‘) projective parameters mapping the calibration plate by a rotation R and translation T to the world camera plane perpendicular to the optical axis of a particluar camera and the internal camera parameters like the focal length f, the principal point x0 and y0 (= foot point of the optical axis), a skew factor s x for non-rectangular pixel, the pixel size and e.g. radial dis tortion terms (figure 2). A variety of planar (2D) and three-dimensional (3D) targets have been used for calibration. A common method consists of recording a known planar calibration target at a few (4-8) shifted and rotated Fig. 2. Camera pinhole model positions by the stereo-rig setup with two cameras. For all recorded views the internal camera parameters and the relative position and orientation between the two cameras are fixed, while the position of the calibration plate is different for each view. These sets of parameter are fitted by a non-linear least-square fit called bundle adjustment. For a good review on the perspective camera pinhole model, calibration and self-calibration methods and bundle adjustment see Hartley and Zissermann (2000). These photogrammetric principles can be applied to the general Stereo-PIV setup to correct misalignments between calibration plate and laser light sheet. The first step is the calibration to compute an accurate volume mapping function M based on the camera pinhole model. In principle other mathematical representation of the optical imaging system could be used, but it is best to start with a good physical model and add statistically significant distortion parameter as needed. In the third-order polynom approach of Soloff et.al. (1997) at least 80 parameters are needed, 20 for each plane and camera, while the basic pinhole model requires only a total of 22 with very high accuracy. Almost everyone in the field of computer vision uses the camera pinhole model. Usually the calibration plate is placed at the position of the light sheet which defines the z=0 plane. Whether the alignment is perfect can be checked by dewarping the recorded camera images with illuminated particles with M-1 and comparing the two images by cross-correlation. Ideally the two images should match perfectly, any deviation (‘disparity map’) is an indication of some misalignment leading to different error sources. If the calibration plate has a z-offset relative to the measurement plane the reconstruction of the three-component vector from the two 2C-vectors uses vectors computed at different locations in the measurement plane. E.g. for an offset of 20 pixel and a velocity gradient of 5% (in units of pixel displacement per pixel distance) the displacement would change by 1 pixe l over a distance of 20 pixel, which leads to considerable errors in the reconstructed 3C-vector. Also slightly wrong derivatives of the mapping 3 functions are used. Finally the coordinate system itself remains warped. E.g. a tilt of the calibration plate by 2 degrees means that the calculated 3C-vector is rotated by 2 degrees. Computation of camera pinhole model using a This disparity map has been used by Willert (1997) by calibration plate simply correcting the position at which for camera 1 and 2 the corresponding 2C-vectors are calculated. Computation of disparity map by cross-correlation This reduces almost comp letely the error due to the camera 1⊗2 using recorded particle images velocity gradient, but does not correct any rotation and leaves the coordinate system slightly warped. It is also not suitable for very large misalignments. A Triangulation of points on the light sheet complete correction approach consists of recomputing a new mapping function from the disparity map. This has been done for the case of telecentric lenses Fitting a plane through the light sheet points (Fournel et.al. 2003), and for normal lenses optionally with Scheimpflug adapters (Fournel and Coudert 2003, Wieneke 2003). Adjusting the mapping function such that new plane It is best to compute the disparity map not by a single becomes z=0 image but by averaging the correlation planes from many images (Meinhart et.al. 1999). Then for each vector a corresponding world point in the Defining a new xy -origin and direction of x-axis measurement plane is computed by a standard triangulation method (Hartley and Sturm 1994). A plane Fig. 3. Self-calibration method: correction of is then fitted through the world points in 3D-space and mapping function onto light sheet the mapping functions of camera 1 and 2 are corrected by a corresponding transformation such that the fitted measurement plane becomes the z=0 plane. The complete correction scheme is shown in figure 3. With the self-calibration procedure it is usually possible to recompute the mapping function such that it is within 0.1 pixel of the center of the light sheet, something hardly possible by simple visual inspection and manual placement of the calibration plate. It can be shown that self-calibration works accurately even for very large misalignments (Wieneke 2003), which eliminates the need to align the calibration plate with the light sheet altogether. While those experiments have been done in air it is necessary to check if the self-calibration method also works in water or other media. 3. EXPERIMENTS WITH TRANSLATED TARGET IN AIR AND WATER The flat target of size 5 x 7 cm with a random dot pattern has been translated in z-direction using a translation stage with an accuracy of about 5 µm. The plate has been moved in z-direction by 1 - 5 mm. The calibration has been done using a dual-plane calibration plate recorded at 8 views at arbitrary position which have been evaluated by bundle adjustment (figure 4). The experiment has been performed in air as well as in water where the z = 0 mm plane was about 45 mm deep in water behind a 3 mm glass plate. In table 1 are shown the main camera pinhole parameter after self-calibration onto the z=0 4 random pattern target. In both air and water the average residual disparity after self-calibration is mainly due to uncertainties in the peak detection of the correlation peak and very small. The angle between the cameras is about 45 degrees. For water the calculated parameters are quite different. The principal point lies way outside the chip and the skew-factor is much less than 1 as would be expected for square pixel. This is due to the distortions of the air-glass-water interface which can only be fitted by the camera pinhole model by unphysical values for sx, f and the principal point. Nevertheless the calibration as a whole seems to be very accurate which is indicated by the fact that for the bundle adjustment in water all calibration points in space were fitted with an accuracy better Fig. 4. Calibration and recording both done in air (left) and in water (right) than 0.1 pixel. Table 1 initial residual x0 / y0 sx disparity disparity [pixel] Air [pixel] [pixel] 65 0.07 8 views bundle Water 8 views bundle 7.9 0.16 f Tx Ty Tz Rx Ry Rz [mm] [mm] [mm] [mm] [°] [°] [°] 20.3 2.7 cam 1: 586 / 552 0.998 60.8 16.1 1.3 411.7 1.4 cam 2: 706 / 548 0.998 60.9 9.2 0.2 435.2 -0.2 -24.3 2.2 cam 1: -1882 / 0.957 81.0 113.9 -10.3 537.6 2.7 4.4 560 - -8.3 570.5 -1.7 -34.1 0.924 83.4 cam 2: 4074 / 491 27.0 4.2 162.0 In table 2 are shown the results of the displacement of the random pattern plate in z direction by 1 to 5 mm. The second row shows the displacements using a triangulation and plane-fit method as in the standard self-calibration procedure. First the disparity of the images recorded at e.g. position z=1mm are computed relative to the corrected mapping function at z=0, and using triangulation the position of points on the z=1 plane are determined, and a plane is fitted through those points. The measured position of the z=1-5mm planes agree very well with the translation stage movement which proves the accuracy of the mapping function throughout the volume. The next row shows the Stereo-PIV evaluation in air using the corrected 8-view bundle calibration. The vector computation was performed with multi-pass iterations and deformed interrogation windows of size 64x64 pixel. The measured displacements in air agree quite well within the uncertainties of the translation stage for 1 and 2 mm displacements. For larger displacements there seems to be a systematic bias. Given the good agreement of the triangulation and plane fit method using the same mapping function this error is probably due to the fact that the 3Creconstruction uses mapping function derivatives calculated only at the z=0 plane. These derivatives change over the quite large distance of 5 mm or 100 pixel. A better way would be to compute the 3C-reconstruction using the more accurate triangulation method. Further investigations are needed to look at this effect in detail. For practical purposes a 5 bias at dz = 1mm (= 20 pixel) with a magnitude of 0.005 mm (= 0.1 pixel) is much less relevant for typical displacements of 5 pixel where the bias would be 0.025 pixel which is commonly less than due to all other error sources. The rms in the u- and v-components remain always around 0.03 pixel. While the average v-displacement is zero everywhere, the u-components show a bias of 0.36 pixel at dz = 1 mm, increasing linearly with larger displacements. Closer inspection revealed that the axis of the translation stage was not exactly perpendicular to the random pattern plate resulting in a slight x-movement. The experiments have been repeated with a translation in x-direction. Again the measured displacements agree very well with the settings from the translation stage. In water the results are similar. For up to 2 mm (40 pixel) the accuracy is very high also with some bias effect for larger displacements. The rms -values are larger than in air due to a residual incorrect warping of the coordinate system which shows up as a gradient in the displacement e.g. for dz = 1mm of the order of 0.03 pixel. The triangulation and plane fit recovers accurately the movement of the plate by the translation stage. This proves that the camera pinhole model and the self-calibration method remains highly accurate even with strong distortions from refractive index changes. Table 2 distance by dz = 1 mm dz = 2 mm dz = 3 mm dz = 4 mm dz = 5 mm translation stage AIR 0.999 mm 2.002 mm 2.996 mm 4.002 mm 5.001 mm triangulation AIR 0.995 ± 0.001 mm 1.992 ± 0.003 mm 2.973 ± 0.003 mm 3.962 ± 0.004 mm 4.941 ± 0.006 mm Stereo-PIV 20.22 ± 0.03 pixel 40.46 ± 0.06 pixel 60.38 ± 0.05 pixel 80.47 ± 0.08 pixel 100.35 ± 0.12 pixel WATER 1.001 mm 2.005 mm 2.995 mm 3.998 mm 4.992 mm triangulation WATER 0.997 ± 0.004 mm 1.995 ± 0.006 mm 2.977 ± 0.007 mm 3.969 ± 0.007 mm 4.949 ± 0.009 mm Stereo-PIV 20.59 ± 0.06 pixel 41.18 ± 0.13 pixel 61.45 ± 0.15 pixel 81.92 ± 0.15 pixel 102.15 ± 0.19 pixel 4. STRATEGIES FOR SELF-CALIBRATION INTO CLOSED MEASUREMENT VOLUMES When it is difficult or impossible to perform a calibration inside the measurement volume it is necessary to calibrate outside and somehow compute a correct mapping function for the measurement plane inside using the disparity map and an appropriate correction scheme. 4.1 Calibration Outside with Similar Optical Setup Given that as shown in the previous section the camera pinhole model without modifications can handle the refractive index change with sufficient accuracy, a straight forward strategy is to perform the calibration outside under conditions as similar to the real measurement condition as possible. As shown in figure 1 (left, middle) this can be done by first focussing the cameras onto the light sheet plane, then retracting both cameras with a translation stage sufficiently such that a small water basin can be placed in front of the water channel, and performing a calibration inside the water basin in the standard way with a single or multi-views of a 2D- or 3D-calibration plate. It is important that the distance between 6 the cameras and the front side of the water basin is the same as it is relative to the front side of the water channel in the real measurement position. Finally the cameras are moved back to the original position and the real experiment is performed and the standard self-calibration procedure can be applied to correct the mapping function onto the light sheet. With an accurate mechanical setup the accuracy of this approach is the same as if both the calibration and the recording were done inside the measurement volume. A scan in z-direction through the measurement volume can be done by moving the laser light sheet to a new z-position and computing the self-calibration separately for each z-position. If the travel distance is larger than the depth-of-focus it is necessary to move the cameras and the light sheet simultaneously. In this case it is required to perform a calibration outside in the water basin for each z-scan position separately by adjusting the distance between cameras and front side of the water basin accordingly. 4.2 Calibration Outside in Air Of course it would easier to perform the calibration outside in air without a water basin and to self-calibrate onto the recorded light sheet in water (figure 1 right). As shown in table 3 this approach leads to large errors. The reason is that it is not possible to fit all parameters of the camera pinhole model to the distorted water case. Especially the internal camera parameter like sx and f are not changed during the standard self-calibration procedure. In principle the disparity map as defined by the 3x3 fundamental matrix equation has 8 degrees of freedom (Hartley and Zissermann 2000) and only the 3 plane parameter need to be refitted by the standard self-calibration method. So one has the extra degrees of freedom to fit parameter like sx or the relative camera orientation. But there are too many parameter to be fitted and one would need to restrict oneself to a some subset given by the particular experimental setup. A better approach is to modify the camera pinhole model to accommodate the air-glass-water interface. This way one goes back to an accurate physically motivated model. A three media model (e.g. air-glass-water) has been implemented according to Maas (1992). Using Snell’s law and an iterative approach one calculates how much a light ray is bend in water. The thickness and refractive index of each medium can be specified. The thickness of the last medium (water) is defined by the distance between the light sheet plane and the previous medium (glass). Right now this value must be still measured. This can be done e.g. by focussing on the light sheet with large aperture (small depth of focus) and then traversing the cameras backwards until a target mounted on the front side of the water channel is in focus. Alternatively the calibration target is mounted on the front side of the water channel and its position is calculated by the standard calibration procedure. Table 3. Calibration in Air and Self-Calibration to Recording in Water distance by dz = 1 mm dz = 2 mm dz = 3 mm dz = 4 mm dz = 5 mm translation stage Standard Model 0.737 mm 1.491 mm 2.228 mm 2.978 mm 3.720 mm Triangulation Standard Model 0.743 ± 0.004 mm 1.486 ± 0.003 mm 2.217 ± 0.006 mm 2.957 ± 0.007 mm 3.688 ± 0.006 mm Stereo-PIV 15.66 ± 0.08 pixel 31.34 ± 0.07 pixel 46.75 ± 0.12 pixel 62.36 ± 0.14 pixel 77.76 ± 0.12 pixel 3-Media Model 0.996 mm 2.005 mm 3.003 mm 7 4.014 mm 5.016 mm Triangulation 3-Media Model 1.006 ± 0.004 mm 2.012 ± 0.004 mm 3.001 ± 0.006 mm 4.001 ± 0.006 mm 4.989 ± 0.015 mm Stereo-PIV 21.55 ± 0.08 pixel 43.08 ± 0.09 pixel 64.26 ± 0.13 pixel 85.69 ± 0.13 pixel 106.81 ± 0.33 pixel The results are very promising as shown in table 3. The movement of the random pattern plate is accurately computed both by the triangulation method and the Stereo-PIV evaluation. For larger displacements again some deviations are visible. The only drawback is that one has to know the distance between the light sheet and the glass plate. Ideally one could also fit this from the disparity map, but initial tests indicate that the fit algorithm then becomes in-stable and is not able to fit the particle plane and the glass plate at the same time. Further work is needed to explore this possibility. 5. SUMMARY Standard Stereo-PIV calibration requires to position the calibration plate exactly at the position of the light sheet. A misalignment can lead to quite large errors, which often go undetected. A self-calibration procedure has been developed to correct the mapping function onto the light sheet by using a camera pinhole model and a volume mapping function. A disparity map is computed by cross-correlation of camera 1 and camera 2 image from which by triangulation the position of the light sheet in space is computed and the mapping function is transformed accordingly. It has been shown that with such a correction the z=0 plane of the mapping function lies within 0.1 pixel of the middle of the light sheet something hardly possible by manual placement. The self-calibration method works accurately in air even for very large misalignments such that it is no longer required to closely align laser sheet and calibration plate. By using a moving plate a with random pattern it has been tested that the camera pinhole model also works for calibration and recordings in water. Since it is often difficult if not impossible to place a calibration plate inside the measurement volume, ideally one would like to calibrate the two cameras outside in air and then self-calibrate onto the recordings e.g. in the water channel. Two approaches were tested. First one can do a calibration outside under similar optical conditions as inside together with the standard self-calibration procedure. This works well with an accurate translation stage to move the two cameras backward and perform a calibration in an extra water basin. Of course it would be easier to perform the calibration outside in air and self-calibrate onto the water recordings. But as it turns out, with the standard camera pinhole model this would lead to large errors. Therefore a modified camera pinhole function with a three-media model air-glass-water has been implemented to account for different refractive indices. This has been verified again with a random pattern plate moved by a translation stage. Residual errors in the computed 3Cvectors due to errors in the mapping function are below of what is expected from all other error sources. This method allows Stereo-PIV measurements inside closed measurement volumes not previously possible. REFERENCES Fournel T, Coudert T, Lavest JM, Collange F, Schon JP (2003) “Self-calibration of telecentric lenses: application to bubbly flow using moving stereoscopic camera”, 4th Pacific Symposium on Flow Visualization and Image Processing, June 2003, Charmonix (France) 8 Fournel T, Coudert T (2003) “Self-calibration of Stereoscopic PIV system in Scheimpflug condition”, EUROPIV 2 Workshop on Particle Image Velocimetry, March 2003, Zaragoza (Spain) Hartley R, Zissermann A (2000) “Multiple View Geometry in Computer Vision”, Cambridge University Press, UK, ISBN 0521623049 Maas HG (1996) “Contributions of digital Photogrammetry to 3D PTV” in “Three-Dimensional Velocity and Vorticity Measuring and Image Analysis Techniques”, Ed. Dracos T, Kluwer, NL, ISBN 0-7923-4256-9 Meinhart CD, Wereley ST, Santiago JG (1999) “A PIV Algorithm For Estimating Time-Averaged Velocity Fields”, Proceedings of Optical Methods and Image Processing in Fluid Flow, 3rd ASME/JSME Fluids Engineering Conference, 1999, San Francisco Soloff SM, Adrian RJ, Liu ZC (1997) “Distortion compensation for generalized stereoscopic particle image velocimetry”, Measurement Science Technology, Vol.8, pp. 1441-1454. Tsai RY (1986) “An Efficient and Accurate Camera Calibration Technique for 3D Machine Vision”, Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, Miami Beach, FL, pp. 364-374 Wieneke B (2003) “Stereo-PIV Using Self-Calibration on Particle Images”, 5th Int. Symp. on PIV, Sept 2003, Busan, Korea, p 3106 Willert C (1997) “Stereoscopic digital particle image velocimetry for application in wind tunnel flows”, Measurement Science and Technology, Vol. 8, pp. 1465-1469 9