28 6 2010 11 JOURNAL OF APPLIED SCIENCES Electronics and Information Engineering Vol. 28 No. 6 Nov. 2010 DOI: 10.3969/j.issn.0255-8297.2010.06.011 200072..... TP391.41 0255-8297(2010)06-0621-07 General Regular Polygon Method for Camera Calibration in Machine Vision ZHANG Yi-cheng, TU Da-wei, ZHAO Qi-jie, WANG Mei School of Mechatronical Engineering and Automation Shanghai University, Shanghai 200072, China Abstract: We expand certain special regular polygon models for camera calibration in machine vision to a general regular polygon model, and propose the general regular polygon calibration method. For general regular polygons, geometrical characteristics on the polygon plane are analyzed. We determine two types of vanishing point according to the cross ratio and the harmonic-conjugate rules in projective geometry. One type is formed by every edge vector of the polygon, and the other formed from the center of the inscribed circle to the tangent points. The camera s intrinsic parameters can then be calculated. Calculation can be done in this way because the direction from the vanishing point to the optic center is the same as that of the vector making the vanishing point. Finally, the general regular polygon calibration method is validated by camera calibration experiments with four specific regular polygons: regular triangle, square, regular pentagon, and regular hexagon. Experimental results also show that, among the four specific regular polygons, calibration accuracy of the regular pentagon model is the highest, while that of the square model is the lowest. Keywords: machine vision, camera calibration, regular polygon, vanishing point, intrinsic parameter [1]... [2-6].. [7] 2010-07-19 2010-10-08 (No.51075252, No.60774102) E-mail: tdwshu@staff.shu.edu.cn
622 28 [8] 3 3 [9].... [7]. 1 1 AB CD ab cd. AB p O 1 uv OX c Y c Z c [u v 1] = K[x c y c z c ] K K = [f u, s, u 0 ; 0, f v, v 0 ; 0, 0, 1]. (u 0, v 0 ) f u f v u v s. X w A Z w O D Y w B C 1 d a c v p b O 1 u Figure 1 Camera model OX c Y c Z c OX w Y w Z w [x c y c z c ] = R[x w y w z w ] + T R T. Z c Y c O Xc (1) α[u v 1] = K(R T )[x w y w x z 1] (1) α. 2 [1].... 2.1 2 A 1 A 2 A 2n 1 A 1A 2 A 2n 1 n = 3. A 1 A 2, A 2 A 3,, A 2n 1 A 1 B 1, B 2,, B 2n 1. I. P A1, P A2,, P A(2n 1) A 1 A 2, A 2 A 3,, A 2n 1 A 1 P B1, P B2,, P B(n+1),, P B(2n 1) B 1 A n, B 2 A n+1,, B n A 2n 1, B n+1 A 1,, B 2n 1 A n 1. A 1, A 2,, A 2n 1 A 1, A 2,, A 2n 1; B 1, B 2,, B 2n 1 B 1, B 2,, B 2n 1 I I P A1, P A2,, P A(2n 1) P A1, P A2,, P A(2n 1) ; P B1, P B2,, P Bn, P B(n+1),, P B(2n 1) P B1, P B2,, P Bn, P B(n+1),, P B(2n 1). (u A1, v A1 ), (u A2, v A2 ),, (u A(2n 1), v A(2n 1) ), (u 1, v 1 ), (u B1, v B1 ), (u B2, v B2 ),,(u B(2n 1), v B(2n 1) ), (u P A1, v P A1 ), (u P A2, v P A2 ),, (u P A(2n 1), v P A(2n 1) ), (u P B1, v P B1 ), (u P B2, v P B2 ),, (u P Bn, v P Bn ), (u P B(n+1), v P B(n+1) ),, (u P B(2n 1), v P B(2n 1) ). 2(a) 2n 1 A 1 I B n I = A 2I B n+1 I = = A n+2 I B 2 I A ni B 2n 1 I = A n+1i B 1 I = = A 2n 1I B n 1 I = λ A 1 B 1 = A 2B 2 = = A 2n 1B 2n 1 = 1 B 1 A 2 B 2 A 3 B 2n 1 A 2 R 1 R 2 λ = R 1 /R 2 = 1/ cos 2π 2n. =
6 623 A 5 B 4 B 5 A 1 I B 1 B 2 A 2 2n 1 m N n m 2n 1. (3) u P Am = u Bm(u Am +u A(m+1) ) 2u Am u A(m+1) 2u Bm u Am u A(m+1) (6) v P Am = v Bm(v Am +v A(m+1) ) 2v Am v A(m+1) 2v Bm v Am v A(m+1) A 4 B 3 A 3 m N, 0 < m < 2n m = 2n 1 m+ 1 = 1. (a) (a) Pentagon model 2.2 A' 5 B' 5 I' A' 1 B' 1 A' 2 3 A 1 A 2 A 2n A 1A 2 A 2n n = 3. A 1 A 2, A 2 A 3,, A 2n A 1 B 1, B 2,, B 2n. I. B' 4 A 1 B' 2 A' 4 2 A' 3 B' 3 (b) (b) Image of pentagon model Figure 2 Pentagon model and its image [11] (B m A n+m, IP Bm ) = (B ma n+m, I P Bm ) = 1 λ, m N 0 < m < n (B m A m n+1, IP Bm ) = (B ma m n+1, I P Bm ) = 1 λ, m N n m 2n 1 (2) (A m A m+1, B m P Am ) = (A ma m+1, B mp Am ) = 1 (3) (3) m N, 0 < m < 2n 1. m = 2n 1 m + 1 = 1. (2) u P Bm = u I (λu A(n+m) +u Bm ) (λ+1)u A(n+m) u Bm (λ+1)u 1 u A(n+m) λu Bm v P Bm = v I (λv A(n+m) +v Bm ) (λ+1)v A(n+m) v Bm (λ+1)v 1 v A(n+m) λv Bm (4) 2n 1 m N 0 < m < n u P Bm = u I (λu A(m n+1) +u Bm ) (λ+1)u A(m n+1) u Bm (λ+1)u I u A(m n+1) λu Bm v P Bm = v I (λv A(m n+1) +v Bn ) (λ+1)v A(m n+1) v Bm (λ+1)v I v A(m n+1) λv Bm (5) A' 5 A' 6 B' 5 A 6 A 5 3 B 5 B 6 A 4 I B 1 B 4 B 3 (a) (a) Pentagon model B' 6 I' A' 1 B' 4 A' B' 3 4 (b) (b) Image of pentagon model B 2 A' 3 A 2 A 3 B' 1 Figure 3 Hexagon model and its image 2n 2n 1. 2n 2n n. n. B' 2 A' 2
624 28 (7) u P Am = u Bm(u Am +u A(m+1) ) 2u Am u A(m+1) 2u Bm u Am u A(m+1) (7) v P Am = v Bm(v Am +v A(m+1) ) 2v Am v A(m+1) 2v Bm v Am v A(m+1) n N 0 < m n. u P Bm = u I (u B(m+n) +u Bm ) 2u B(n+m) u Bm 2u I u B(n+m) u Bm (8) v P Bm = v I (v B(m+n) +v Bm ) 2v B(n+m) v Bm 2v I v B(n+m) v Bm m N 0 < m n. 3 [11] l H L = (l T, 0) T H p L p (9) αp = K[R, T ]L = KRL (9) l = αr 1 K 1 p (10) (10) H l.. B m A (m+n) A (m+n) A (m+n+1) 2n 1 m N, 0 < m < n m = n 1 m + n + 1 = 1 (12) M 1 M 6 k 6. 2n 1 2n 1 (12). (12).. M 1 M 6 [12] v 0 = (M 2 M 4 M 1 M 5 )/(M 1 M 4 M 2 M 2 ) λ = M 6 [M 3 M 3 + v 0 (M 2 M 3 M 1 M 5 )]/M 1 f u = λ/m 1 f v = λ[m 1 /(M 1 M 4 M 2 M 2 )] s = M 2 fuf 2 v /λ u 0 = sv 0 /f u M 3 fu/λ 2 4 4.1 Samsung 5.8 f 17.4 mm (f= 5.8 mm). [13] 4 4 1 15 640 480. 4. B m A (m n+1) A (m n+1) A (m n+2) 2n 1 m N n m 2n 1. (1) p T AmK -T K 1 p Bm = α A P T Am [R T ] T α B [R T ]P Bm = α A α B P T Am P Bm = 0 (11) M = K T K 1 M M 6 M 1 M 6 (11) u pam u pbm M 1 + (v pam u pbm + u pam v pbm )M 2 + (u pam + u pbm )M 3 + v pam v pbm M 4 + (v pam + v pbm )M 5 + M 6 = 0 (12) 4 Figure 4 Corners detection images of the checkerboard model M = [668.906, 0, 332.542; 670.782, 0, 236.367; 0, 0, 1]; [k 1, k 2, p 1, p 2 ] T = [ 0.142, 0.268, 0.004 64, 0.002 04] T. 4 9 640 480.. OpenCV.
Z 6 625 OpenCV cvgoodfeaturestotrack cvfindcornersubpix(). cvgoodfeaturestotrack quality_level min_distance cvfindcornersubpix() win criteria. u v. 5. 4.2 6. T = [ 54.044, 62.701, 391.033] 0.008 3 0.999 7 0.021 8 R = 0.999 5 0.008 2 0.005 4 0.005 2 0.021 3 0.999 7 1 (u d, v d ). ` 350 300 250 200 150 100 50 0 0 50 Y 100 0 X 50 100 (a) (a) Camera situation image 5 Figure 5 Corners detection images of some special regular polygon models. 4. 1. 1 Table 1 Results of the camera calibration with regular polygon and checkerboard method f x 670.56 653.75 663.72 658.44 668.91 f y 652.48 675.15 664.09 667.32 670.78 u 0 326.45 332.34 331.20 330.25 332.54 v 0 240.30 242.45 241.85 242.78 239.37 s 11.36 6.55 3.22 20.57 0.00 6 (b) (b) Checkerboard image Figure 6 Camera situation image and checkerboard image [14] (u u, v u ). ( u i, v i ) = (u id u u, v id v u ) ( u, v) = 1 n ( n i=1 u id u u, n i=1 v id v u ) d = u 2, v 2. 7.
626 28 + O (a) (a) Error correction tendency of the corners in regular square models. 7. 8. 8 d = 1.44 d = 1.73 d = 0.89 d = 1.27. 2.0 1.5 1.0 0.5 0 reprojection (in pixel) y 0.5 1.0 + O (b) (b) Error correction tendency of the corners in regular triangle models + O (c) (c) Error correction tendency of the corners in regular pentagon models 8 1.5 2.0 2.5 3.0 2.0 1.5 1.0 0.5 0 0.5 1.0 1.5 2.0 2.5 3.0 x models 5 Figure 8 Error distribution image of the checkerboard model and some regular polygon.. 7 + O (d) (d) Error correction tendency of the corners in regular hexagon models Figure 7 Error correction tendency of the corners reprojection coordinate in regular polygon models 7 : [1]. [M]. 2008, 2: 39-49. [2]. [J]., 2006,28(4): 400-406. Yang Guanglin, Kong Lingfu, Wang Jie. A new calibration approach to hand-eye relation of manipulato[j]. Robot, 2006, 28(4): 400-406. (in Chinese) [3]. [J]., 2008, 30(4): 372-376.
6 627 Xu Haixia, Wang Yaonan, Wan Qin. A selfcalibration approach to hand-eye relation of robot[j]. 2008, 30(4): 372-376. (in Chinese) [4] Iwata K, Satoh Y, Yoda I, Sakaue K. Hybrid camera surveillance system using robust human detection[j]. Electronics and Communications in Japan, 2008, 91(11) : 11-18. [5] Faugeras O, Quan L, Sturm P. Self-calibration of a 1D projective camera and its application to the self-calibration of a 2D projective camera[j]. Lecture Notes in Computer Science, 1998 (1406): 36-38 [6] Pollefeys M, Koch R, Van Gool L. Selfcalibration and metric reconstruction in spite of varying and unknown internal camera parameters[c]//international Conference on Computer Vision, 1998, 32, 1: 7-25. [7]. [C]// 2006: 1-4. Hu Peicheng, Li Ning. A novel approach for camera calibration based on vanishing points [C]//Thirteenth meeting of the National Image and Graphics, 2006: 1-4. (in Chinese) [8]. [J]. 2005, 24(6): 85-88. Qiu Weiguo, Ang Haisong. Scheme for camera calibration based on single parallelepiped photo[j]. Journal of Transducer Technology, 2005, 24(6): 85-88.(in Chinese) [9]. [J]., 2008, 40(10): 1065-1069. Hu Zhaozheng, Tan Zheng. Camera calibration with conics fitting and circular point[j]. Journal of Xi an Jiaotong University, 2008, 40(10): Chinese) 1065-1069. (in [10]. [J]. 2004, 25(5): 597-599. He Junji, Zhang Guangjun, Yang Xianming. Approach for calibration of lens distortion based on cross ratio invariability[j]. Chinese Journal of Scientific Instrument, 2004, 25(5): 597-599.(in Chinese) [11]. [J]. 2005, 1: 42-46. Hu Zhaozheng, Tan Zheng. A novel approach for camera calibration based on two vanishing points[j]. Space Electronic Technolog, 2005, 1: 42-46. (in Chinese) [12] Zhang Zhengyou. A flexible new technique for camera calibration [J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2000, 22(11): 1330-1334. [13]. OpenCV [J]. 2007, 28(1): 197-199. Yin Wensheng, Luo Yulin, Li Shiqi. Camera calibration based on open CV [J]. Computer Engineering and Design, 2007, 28(1): 197-199.(in Chinese) [14]. [J]. 2009, 45(8): 228-232. Zhou Fuqiang, Cai Feihua. Camera calibration method based on non-metric distortion correction[j]. Journal of Mechanical Engineering, 2009, 45(8): 228-232.(in Chinese) ( : )