OpenCV鱼眼相机标定模型


本文对OpenCV鱼眼相机标定模型进行了整理

前情提要:关于相机成像畸变模型,可戳相机成像畸变模型与鱼眼相机模型

鱼眼相机模型

$X$是世界坐标系中一点$P$的坐标,$R$是旋转矩阵,$T$是平移向量,点$P$在相机坐标系下的坐标可表示为

$x,y,z$是$X_c$的三个坐标,可表示为

P点小孔投影的坐标为$[a;b]$,其中

鱼眼畸变模型

畸变点的坐标$[x’;y’]$

最终的像素坐标系坐标$[u;v]$

鱼眼图像标定、校正代码

1.cv::fisheye::calibrate()

首先使用标定板标定相机。该函数输入角点,返回鱼眼相机内参K、D和外参R、T。
其中,K是33的相机内参矩阵,D是畸变系数,R是旋转向量,T是平移向量

2.cv::getOptimalNewCameraMatrix

Returns the new camera intrinsic matrix based on the free scaling parameter.

根据比例因子返回新的相机内参矩阵

3.cv::fishheye::initUndistortRectifyMap

Computes undistortion and rectification maps for image transform by cv::remap(). If D is empty zero distortion is used, if R or P is empty identity matrixes are used.

该函数计算原始图像和矫正图像之间的转换关系,输入是鱼眼相机内参,输出是两者间的映射关系map1和map2。

4.cv::remap

The function remap transforms the source image using the specified map:

where values of pixels with non-integer coordinates are computed using one of available interpolation methods. mapx and mapy can be encoded as separate floating-point maps in map1 and map2 respectively, or interleaved floating-point maps of (x,y) in map1, or fixed-point maps created by using convertMaps. The reason you might want to convert from floating to fixed-point representations of a map is that they can yield much faster (2x) remapping operations. In the converted case, map1 contains pairs (cvFloor(x), cvFloor(y)) and map2 contains indices in a table of interpolation coefficients.

使用map1和map2进行矫正


文章作者: Jingyi Yu
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Jingyi Yu !
  目录