ROSETTA CIVA-P DATA CALIBRATION DESCRIPTION =========================================================================== Revisions --------- 2009-04-20 first issue, IAS Purpose ------- This document describes the calibration of the CIVA-P data delivered in the CIVA level 3 data set. The calibration is not final. It will be improved and updated in a later version of the data set. Introduction ============ The calibration of CIVA-P raw images is realized in the following steps (applied in that order): 1) Geometrical correction 2) Non-linearity correction 3) Photometric correction 4) Determination of instantaneous line of sight 1) Geometrical correction ====================== This calibration function modifies the position of each pixel of a given picture, in order to take into account the distortion effects. The relation between the corrected coordinates of one point in the image plane and the distorted coordinates is given by a matrix type equation, which parameters are deduced from ground calibration data recorded for each individual camera. The geometrical calibration was realized on ground, using the technique and a software (matlab toolbox) developed by Jean Yves Bouguet (http://www.vision.caltech.edu/bouguetj/calib_doc/index.html). The toolbox gives intrinsic and extrinsic calibration parameters for a camera. For CIVA-P cameras, only the intrinsic parameters were considered. The extrinsic parameters that can be used for stereo image reconstruction are given in file COEFF_GEOM_EXT_STEREO.TAB. This file gives the orientation and the position of right camera wrt left camera (rotation matrix and translation vector). Intrinsic parameters (camera model): - Focal length: The focal length in pixels is stored in the 2x1 vector fc. - Principal point: The principal point coordinates are stored in the 2x1 vector cc. - Skew coefficient: The skew coefficient defining the angle between the x and y pixel axes is stored in the scalar alpha_c. - Distortions: The image distortion coefficients (radial and tangential distortions) are stored in the 5x1 vector kc. Definition of the intrinsic parameters: Let P be a point in space of coordinate vector XXc = [Xc;Yc;Zc] in the camera reference frame. Let us project now that point on the image plane according to the intrinsic parameters (fc,cc,alpha_c,kc). Let xn be the normalized (pinehole) image projection: [ Xc/Zc ] [ x ] xn = [ ] = [ ] [ Yc/Zc ] [ y ] Let r2 = x2 + y2. After including lens distortion, the new normalized point coordinate xd is defined as follows: [ xd(1) ] xd = [ ] = (1 + kc(1)*r2 + kc(2)*r4 + kc(5)*r6) * xn + dx [ xd(2) ] where dx is the tangential distortion vector: [ 2*kc(3)*x*y + kc(4)*(r2 + 2*x2) ] dx = [ ] [ kc(3)*(r2 + 2*y2) + 2*kc(4)*x*y ] Therefore, the 5-vector kc contains both radial and tangential distortion coefficients (observe that the coefficient of 6th order radial distortion term is the fifth entry of the vector kc). It is worth noticing that this distortion model was first introduced by Brown in 1966 and called "Plumb Bob" model (radial polynomial + "thin prism"). The tangential distortion is due to "decentering", or imperfect centering of the lens components and other manufacturing defects in a compound lens. Once distortion is applied, the final pixel coordinates x_pixel = [xp;yp] of the projection of P on the image plane is: xp = fc(1)*(xd(1) + alpha_c*xd(2)) + cc(1) yp = fc(2)*xd(2) + cc(2) Therefore, the pixel coordinate vector x_pixel and the normalized (distorted) coordinate vector xd are related to each other through the linear equation: [ xp ] [ xd(1) ] [ yp ] = KK . [ xd(2) ] [ 1 ] [ 1 ] where KK is known as the camera matrix, and defined as follows: [ fc(1) alpha_c * fc(1) cc(1) ] KK = [ 0 fc(2) cc(2) ] [ 0 0 1 ] In matlab, this matrix is stored in the variable KK after calibration. fc(1) and fc(2) are the focal distance (a unique value in mm) expressed in units of horizontal and vertical pixels. Both components of the vector fc are usually very similar. The ratio fc(2)/fc(1), often called "aspect ratio", is different from 1 if the pixel in the CCD array are not square. Therefore, the camera model naturally handles non-square pixels. In addition, the coefficient alpha_c encodes the angle between the x and y sensor axes. Consequently, pixels are even allowed to be non-rectangular. Some authors refer to that type of model as "affine distortion" model. For CIVA-P we assume - zero skew (alpha_c=0). - 4th order radial component of distortion model (i.e. keeping kc(5)=0 and thus having a 4 elements distortion vector ). - pixel coordinates are defined such that [0;0] is the center of the upper left pixel of the image. The geometric correction described above is applied by means of the OpenCV function 'cvUndistort2'. The photometric and geometric calibration parameters are stored in ASCII files in CALIB directory (the parameters for unit 5 have not yet been calculated): - photometric - COEFF_PHOTO_UNIT_1.TXT - COEFF_PHOTO_UNIT_2.TXT - COEFF_PHOTO_UNIT_3.TXT - COEFF_PHOTO_UNIT_4.TXT - COEFF_PHOTO_UNIT_6.TXT - COEFF_PHOTO_UNIT_7.TXT - geometric - COEFF_GEOM_UNIT_1.TXT - COEFF_GEOM_UNIT_2.TXT - COEFF_GEOM_UNIT_3.TXT - COEFF_GEOM_UNIT_4.TXT - COEFF_GEOM_UNIT_6.TXT - COEFF_GEOM_UNIT_7.TXT 2) Non-linearity correction ======================== Each image is corrected by a factor in order to recover non linearity problems for pixels with signal levels. This exponential type function is applied to all pixels with level over a given DN level. The linearity correction is realized using the following table. Camera Gain exposition DN (digit) Transfer level duration(ms) domain function (from TC) Civa-P #3 12 150 DN <= 650 DN_corr=DN 650 < DN <= 780 DN_corr=DN* (1+2E-09*exp(0.0243*DN)) Civa-P #2 12 150 DN <= 530 DN_corr=DN 530 < DN <= 636 DN_corr=DN* (1+E-06*exp(0.0217*DN)) Civa-P #7 12 150 DN <= 530 DN_corr=DN 625 < DN <=750 DN_corr=DN* (1+0.0002*exp(0.0069*DN)) Civa-P #4 12 150 DN <= 650 DN_corr=DN 650 < DN <= 780 DN_corr=DN* (1+1E-07*exp(0.0188*DN)) Civa-P #6 12 150 DN <= 650 DN_corr=DN 650 < DN <= 780 DN_corr=DN* (1+6E-08*exp(0.0172*DN)) Civa-P #1 13 150 DN <= 720 DN_corr=DN 720 < DN <= 864 DN_corr=DN* (1+5E-08*exp(0.0179*DN)) The relation between the commanded gain "x" (given in the above table) and the analog gain "G" is the following: G=4/(1+3*((15-x)/15)) The linearity correction algorithm is as follows. For a given image: - calculate the analog gain (G) from the gain level in the table above and the gain number (ROSETTA:GAIN_NUMBER keyword in the PDS label of the image) - calculate DN taking into account the gain: DN = DN_image*G_from_table/G_from_image_label - for each pixel calculate the corrected DN (DN_corr) taking into account the DN domain from the table above 3) Photometric correction ====================== On the geometrically corrected image (from step 1) each pixel is corrected by a multiplying factor, recorded in a (1024 x 1024) coefficient matrix, provided for each individual camera and derived from ground calibration (coeff_photo_XX). 4) Instantaneous line of sight =========================== Determination for each pixel (after geometrical correction, step 1) in the image plane of the instantaneous line of sight, with angular references with respect to the centre of the detector and according to its main coordinate frame. The position and orientation of CIVA-P cameras in the Lander system are shown in figures 1, 2 and 3. The following table gives the line of sight of each pixel in each row (respectively column), with respect to the center and uses the following information Pixel number Angle in degree 0 -29.9515197 63 -26.8020604 127 -23.41322445 191 -19.84167021 255 -16.10211375 319 -12.21634884 383 -8.213210702 447 -4.127810305 511 0 575 4.127810305 639 8.213210702 703 12.21634884 767 16.10211375 831 19.84167021 895 23.41322445 959 26.8020604 1023 30 The direction of the center line of sight, use following information: CIVA-P camera number Azimuth (deg) Elevation (deg) 3 -180.00 -17.69 2 -119.34 -16.33 1 -59.41 -13.64 5 +59.41 -13.64 4 +119.34 -16.33 6/7 stereo pair 0.00 -22.31 Azimuth: from +XS/C counterclockwise, +/-0.5 deg Elevation: from XYS/C-plane, +/-0.5 deg Method of calculation of borehole angles in S/C system: [-1 0 0] [cos(delta) 0 sin(delta)] [-cos(delta) 0 -sin(delta)] D= [ 0 -1 0] . [ 0 +1 0 ] = [ 0 -1 0 ] [ 0 0 +1] [-sin(delta 0 cos(delta)] [-sin(delta) 0 cos(delta)] R_S/C = D . r_L [cos(beta).cos(lambda)] r_L = [cos(beta).sin(lambda)] [ sin(beta) ] lambda = (0, 60, 120, 180, 240, 300) deg beta = (-15, -15, -15, -25, -15, -15) deg delta = 2.69 deg D is the rotation matrix to transform a Lander direction vector r_L into an orbiter direction vector R_S/C. It first rotates by the angle delta around the +Y-axis, then by 180 degrees around the +Z-axis. Lambda are the azimuths of the CIVA boreholes in the Lander system, beta the elevations of the CIVA boreholes in the Lander system. Expression of R_S/C in spherical coordinates yields the azimuths and elevations in the Orbiter coordinate system.