##序言:先展示下效果,随后有空总结下原理和具体代码
鱼眼焦距:小于16
鱼眼视距:大于120
鱼眼相机优势:显示范围广,矫正后的特征更明显
相机矩阵:包括焦距(fx,fy),光学中心(Cx,Cy),完全取决于相机本身,是相机的固有属性,只需要计算一次,可用矩阵表示如下:[fx, s, Cx; 0, fy, Cy; 0,0,1];
畸变系数:
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 229.18796013, 0., 959.2765099, 0.,
217.59214502, 639.42341529, 0., 0., 1. ]
dist_coeffs: !!opencv-matrix
rows: 4
cols: 1
dt: d
data: [ 0.2998425,0.08655333,
0.04872814,0.00092806 ]
在这里插入代码片 data: [ -2.0513926287326148e-01, -1.1003402373393436e+00,
7.9193175454376649e+02, -4.5403326443024684e-03,
-1.1312860190554999e+00, 6.8991568409882564e+02,
-1.0596555001414414e-05, -1.8332755853986058e-03, 1. ]
cv::Mat map1, map2;
cv::fisheye::initUndistortRectifyMap(prms.camera_matrix, prms.dist_coff, cv::Mat(), new_camera_matrix, prms.size , CV_16SC2, map1, map2);
cv::remap(src, dst, map1, map2, cv::INTER_LINEAR, cv::BORDER_CONSTANT);
cv::warpPerspective(src, src, prm.project_matrix, project_shapes[prm.name]);