鱼眼相机模型-相机畸变

 

鱼眼镜头

鱼眼相机镜头是由十几个不同的透镜组合而成,在成像的过程中,入射光线经过不同程度的折射,投影到尺寸有限的成像平面上,使得鱼眼镜头拥有更大的视野范围。下图为鱼眼相机的组成结构:

与针孔相机原理不同,鱼眼镜头采用非相似成像,在成像过程中引入畸变,通过对直径空间的压缩,突破成像视角的局限,从而达到广角成像。

所以鱼眼镜头是一种极端 的广角镜头,通常焦距小于等于16mm并且视角接近或等于180°(在工程上视角超过140°的镜头即统称为鱼眼镜头)。

相机畸变

鱼眼镜头无论如何它的边缘线条都是要弯曲的,即使90度的鱼眼也是这样,这种畸变我们在很多广角镜头上都可以看到,而这就是明显的桶形畸变。同样的120度的鱼眼看起来弯曲的更加厉害一些了,而且被容纳进范围的景物更多;150度同样如此,而180度的鱼眼则可以把镜头周围180度范围内的所有物体都拍摄进去。众所周知,焦距越短,视角越大,因光学原理产生的变形也就越强烈。为了达到180度的超大视角,鱼眼镜头不得不允许这种变形(桶形畸变)的合理存在。

针对原始图像进行畸变校正后,带有冗余边界,需要做进一步截取。如下图:

 

畸变模型和参数

 

鱼眼相机投影模型有: 等距投影  正交投影  等立体角投影    体视投影 ;成像模型:先将三维点投影到单位球面,再将单位球面上的点投影到归一化平面上。

但这些,对于 不搞镜头研发,只搞 图像处理的我们都不必关心,我们关心下面的opencv 模型

 

opencv https://docs.opencv.org/3.4/db/d58/group__calib3d__fisheye.html

 

由 世界坐标点和图像坐标点,标定得到相机 内参、外参、畸变参数

 

 

 

 1 double cv::fisheye::calibrate    (
 2     InputArrayOfArrays     objectPoints,
 3         InputArrayOfArrays     imagePoints,
 4         const Size &     image_size, 
 5         InputOutputArray     K,
 6         InputOutputArray     D,
 7         OutputArrayOfArrays     rvecs,
 8         OutputArrayOfArrays     tvecs,
 9         int     flags = 0,
10        TermCriteria     criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 100, DBL_EPSILON) 
11 )    

 

 1 objectPoints    vector of vectors of calibration pattern points 
 2                 in the calibration pattern coordinate space.
 3 imagePoints        vector of vectors of the projections of calibration pattern points. 
 4                 imagePoints.size() and objectPoints.size() and imagePoints[i].size() 
 5                 must be equal to objectPoints[i].size() for each i.
 6 image_size        Size of the image used only to initialize the camera intrinsic matrix.
 7 K                Output 3x3 floating-point camera intrinsic matrix 
 8                 If fisheye::CALIB_USE_INTRINSIC_GUESS is specified, 
 9                 some or all of fx, fy, cx, cy must be initialized before calling the function.
10 D                Output vector of distortion coefficients (k1,k2,k3,k4).
11 rvecs            Output vector of rotation vectors (see Rodrigues ) estimated for each pattern view. 
12                 That is, each k-th rotation vector together with the corresponding k-th translation vector 
13                 (see the next output parameter description) brings the calibration pattern from the model 
14                 coordinate space (in which object points are specified) to the world coordinate space, 
15                 that is, a real position of the calibration pattern in the k-th pattern view (k=0.. M -1).
16 tvecs            Output vector of translation vectors estimated for each pattern view.
17 flags            Different flags that may be zero or a combination of the following values:
18      fisheye::CALIB_USE_INTRINSIC_GUESS cameraMatrix contains valid initial values of fx, fy, cx, cy 
19                           that are optimized further. Otherwise, (cx, cy) is initially set to the image center 
20                           ( imageSize is used), and focal distances are computed in a least-squares fashion.
21      fisheye::CALIB_RECOMPUTE_EXTRINSIC Extrinsic will be recomputed after each iteration of intrinsic optimization.
22      fisheye::CALIB_CHECK_COND The functions will check validity of condition number.
23      fisheye::CALIB_FIX_SKEW Skew coefficient (alpha) is set to zero and stay zero.
24      fisheye::CALIB_FIX_K1,..., fisheye::CALIB_FIX_K4 Selected distortion coefficients are set to zeros and stay zero.
25      fisheye::CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global optimization. 
26                       It stays at the center or at a different location specified when 
27                       fisheye::CALIB_USE_INTRINSIC_GUESS is set too.
28 
29 criteria    Termination criteria for the iterative optimization algorithm.

 

posted @ 2022-02-12 19:30  张志伟122  阅读(1230)  评论(0编辑  收藏  举报