图像畸形矫正原理和公式:
鱼眼:
// 畸变参数,vins-mono截取代码
double k1 = mParameters.k1();
double k2 = mParameters.k2();
double p1 = mParameters.p1();
double p2 = mParameters.p2();
// Apply inverse distortion model
// proposed by Heikkila
mx2_d = mx_d*mx_d; // x^2
my2_d = my_d*my_d; // y^2
mxy_d = mx_d*my_d; // xy
rho2_d = mx2_d+my2_d; // r^2 = x2 + y2
rho4_d = rho2_d*rho2_d; // r^4
radDist_d = k1*rho2_d+k2*rho4_d;
// 去畸变后的坐标
Dx_d = mx_d*radDist_d + p2*(rho2_d+2*mx2_d) + 2*p1*mxy_d;
Dy_d = my_d*radDist_d + p1*(rho2_d+2*my2_d) + 2*p2*mxy_d;
inv_denom_d = 1/(1+4*k1*rho2_d+6*k2*rho4_d+8*p1*my_d+8*p2*mx_d);
//鱼眼相机的k3=0
mx_u = mx_d - inv_denom_d*Dx_d;
my_u = my_d - inv_denom_d*Dy_d;
枕形和桶形
见网址:去畸变大佬文章