Transform deviations due to distortion?
 From: Kasim Rehman Received: Dec 24, 2001 To ARToolkit Subject: Transform deviations due to distortion? ```Hi, I am stuck with a problem concerning the calculation of a transform between two markers. I can get the transform between the two, but moving the camera (still with the two markers in view) slightly gives me other values for the transform between the two. I saw that Wayne once wrote an email about this problem. In that he explained that the projection matrix contains hidden distortion parameters. When I looked at the code, I came to the conclusion that during the calibration process (and subsequent calculation of the projection matrix) distortion factors are only ever used to *draw* the warped lines on the image, but do not enter the calculation. (The conversion of the projection matrix to an OpenGL matrix does not involve distortion correction but a Q-R decomposition at the end). Assuming the projection matrix is independent of the distortion (and hence does not perform distortion correction itself), arGetTransMat should return values that do not depend on the distortion of the lens (if AR_FITTING_TO_IDEAL is set). Why then do I seem to get different values for the transform if I move the camera or turn it around its z-axis? __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com ```
 From: Hirokazu Kato Received: Dec 25, 2001 To Kasim Rehman Subject: Re: Transform deviations due to distortion? ```Hi, >I am stuck with a problem concerning the calculation >of a transform between two markers. I can get the >transform between the two, but moving the camera >(still with the two markers in view) slightly gives me >other values for the transform between the two. The measurement accuracy of ARToolKit is not so good. Especially in the case careful camera calibration was not done. This is not strange. It is a single camera system. Also imagine the case of the orthogonal projection camera. It is impossible to get depth information from the size of region in the image. Because the size is not depend on the depth value. That is, if a long focal length camera is used, accuracy would be very bad. >I saw that Wayne once wrote an email about this >problem. In that he explained that the projection >matrix contains hidden distortion parameters. When I >looked at the code, I came to the conclusion that >during the calibration process (and subsequent >calculation of the projection matrix) distortion >factors are only ever used to *draw* the warped lines >on the image, but do not enter the calculation. Yes. Because, the parameters in the calibration code represent straight lines in the ideal plane. Then when user fits computer generated warped line to the captured image (captured image means distorted observed image), the program keeps straight line parameter in the ideal screen plane. Therefore from this calibration process, projection transformation from 3D camera coordinates to Ideal screen coordinates can be obtained. By the way, ideal perspective projection is represented by hx f 0 x0 X hy = 0 f y0 * Y h 0 0 1 Z where f is focal length, (x0,y0) is the center coordinates. But in the case of ARToolKit, projection parameters are represented by hx f s x0 X hy = 0 af y0 * Y h 0 0 1 Z where f is focal length, s is skew of the image, a is aspect ratio, and (x0,y0) is the center coordinates. So I think some people may understand these parameters include distortion information regarding skew and aspect ratio. However this projection matrix can convert any straight lines in 3D space to straight line in the image plane. Then usually What I talk about distortion is just radial distortion which converts a straight line to a warped line. >Assuming the projection matrix is independent of the >distortion (and hence does not perform distortion >correction itself), arGetTransMat should return values >that do not depend on the distortion of the lens (if >AR_FITTING_TO_IDEAL is set). That is Right. >Why then do I seem to get different values for the >transform if I move the camera or turn it around its >z-axis? There are some checkpoints: 1) Did you calibrate your camera very carefully? 2) Dosen't your camera get too distorted image? In my case, distortion factor from 'calib_dist' is about 20-80. 3) Are you using short focal length camera? In my case, my camera has about 500-800 value for f in above equation. 4) Did you specify correct marker size to the parameter for arGetTransMat? 5) Are you using same length unit through all procedures (usually [mm])? -- ---- Hirokazu Kato ```