给出由径向和切向畸变定义的针孔模型的畸变系数 D = k1,k2,p1,p2,k3 。 如何通过这些系数使图像失真? 我知道 cv2.undistort()函数。谁能解释我如何实现不失真功能来执行迭代最小化?
# TODO: Iterative minimization required
r2 = x_ * x_ + y_ * y_
# Remove tangential distortion
x_tangential = x_ - (2 * distort_coeffs[2] * x_ * y_ + distort_coeffs[3] * (r2 + 2 * x_ * x_))
y_tangential = y_ - (distort_coeffs[2] * (r2 + 2 * y_ * y_) + 2 * distort_coeffs[3] * x_ * y_)
# Remove radial distortion
x = x_tangential / (1 + distort_coeffs[0] * r2 + distort_coeffs[1] * r2 * r2 + distort_coeffs[4] * r2 * r2 * r2)
y = y_tangential / (1 + distort_coeffs[0] * r2 + distort_coeffs[1] * r2 * r2 + distort_coeffs[4] * r2 * r2 * r2)
cam_coords_undistorted = torch.cat([x, y, ones], 1)
答案 0 :(得分:0)
有两种情况: