Extrinsic Calibration of a 3D Laser Scanner and an Omnidirectional Camera【雷达-相机标定论文精读】

论文链接:

https://www.sciencedirect.com/science/article/pii/S1474667016350790

一、激光雷达矫正标定

偏差 = 手动测量距离 - tof所测距离:

RANSAC选取最多点落在的平面,最小化投影误差求解偏差。

二、外参标定

2.1 相机部分

标定板平面:

从世界坐标系到ci帧坐标系:

从ci帧到head帧坐标系:

3D点与图像坐标系2D点:

转换关系:

最小化重投影误差求外参:

R是由三个欧拉角参数化的正交旋转矩阵:

P为平面上中心到任一点的向量,标定板平面在ci帧的方程为:

在ci帧坐标系中标定板法向量:

ci帧相机中心到标定板的距离:

head帧相机中心到标定板距离:

2.2 雷达部分

RANSAC拟合平面,再选出平面上的3D点:

这些点在相机head帧坐标系的坐标:

其中的Rt为待求外参。

激光打在标定板上的点在法向量的投影 = 标定板到相机中心的距离。最小化多个姿态视角下的重投影误差求解相机-雷达外参:

其中N_h^i在head帧坐标系下的第i个pose下标定板法向量。

2.3 估计协方差

Haralick(1998)描述了一种方法,可以通过任何一种标量非线性优化函数来传播测量的协方差。唯一的假设是标量函数是非负的,具有有限的1阶和2阶偏导数,对于理想数据其值为零,并且输入中的随机扰动足够小,以便可以将输出近似为1阶泰勒级数展开。(17)式满足。

其中t为在l坐标系下l到h的三维欧式向量

$$\Phi$$为h到l的旋转矩阵对应的欧拉角

协方差为

其中X为测量向量

三、实验结果

标定板面积大、姿态数量多,误差小

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 以下是使用Open3D库进行双目相机标定的示例代码: ```python import open3d as o3d import numpy as np import cv2 # 相机内参矩阵 K = np.array([[fx, 0, cx], [0, fy, cy], [0, 0, 1]]) # 棋盘格纹路大小 pattern_size = (6, 9) # 准备对象点 objp = np.zeros((pattern_size[0] * pattern_size[1], 3), np.float32) objp[:, :2] = np.mgrid[0:pattern_size[0], 0:pattern_size[1]].T.reshape(-1, 2) # 存储对象点和图像点的数组 obj_points = [] # 3D点在世界坐标系中 img_points_l = [] # 2D点在左相机图像平面上 img_points_r = [] # 2D点在右相机图像平面上 # 读取左右相机图像 img_left = cv2.imread('left.png') img_right = cv2.imread('right.png') # 查找棋盘格角点 found_left, corners_left = cv2.findChessboardCorners(img_left, pattern_size, None) found_right, corners_right = cv2.findChessboardCorners(img_right, pattern_size, None) if found_left and found_right: # 提取左右相机图像平面上的角点 gray_left = cv2.cvtColor(img_left, cv2.COLOR_BGR2GRAY) gray_right = cv2.cvtColor(img_right, cv2.COLOR_BGR2GRAY) corners_left = cv2.cornerSubPix(gray_left, corners_left, (11, 11), (-1, -1), criteria=(cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)) corners_right = cv2.cornerSubPix(gray_right, corners_right, (11, 11), (-1, -1), criteria=(cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)) # 绘制并显示棋盘格角点 cv2.drawChessboardCorners(img_left, pattern_size, corners_left, found_left) cv2.drawChessboardCorners(img_right, pattern_size, corners_right, found_right) cv2.imshow('Left Image', img_left) cv2.imshow('Right Image', img_right) cv2.waitKey(0) # 存储对象点和图像点 obj_points.append(objp) img_points_l.append(corners_left) img_points_r.append(corners_right) # 双目相机标定 rms, K_left, D_left, K_right, D_right, R, T, E, F = cv2.stereoCalibrate(obj_points, img_points_l, img_points_r, K, None, K, None, gray_left.shape[::-1], flags=cv2.CALIB_FIX_INTRINSIC) # 打印标定结果 print('RMS:', rms) print('K_left:', K_left) print('D_left:', D_left) print('K_right:', K_right) print('D_right:', D_right) print('R:', R) print('T:', T) print('E:', E) print('F:', F) # 保存标定结果 np.savez('stereo_calib.npz', K_left=K_left, D_left=D_left, K_right=K_right, D_right=D_right, R=R, T=T, E=E, F=F) else: print('Chessboard not found.') ``` 在上述代码中,我们首先定义了相机内参矩阵 `K` 和棋盘格纹路大小 `pattern_size`。然后,我们准备了对象点 `objp`,该对象点包含棋盘格上每个角点的坐标。接着,我们读取了左右相机的图像,使用OpenCV的 `cv2.findChessboardCorners()` 函数在两张图像中查找棋盘格角点,并使用 `cv2.cornerSubPix()` 函数获取更加精确的角点坐标。 接下来,我们将对象点和图像点存储到数组中,并使用 `cv2.stereoCalibrate()` 函数进行双目相机标定。最后,我们将标定结果打印出来,并将其保存到文件中。 需要注意的是,此代码示例只提供了一个简单的双目相机标定方法,实际应用中可能需要更加完善的标定方法,并考虑更多的误差因素。 ### 回答2: Open3D 双目相机标定代码主要涉及以下步骤: 1. 导入 Open3D 库和其他必要的依赖库。 2. 读取双目相机的图像和深度图像,并将它们转换为 Open3D 中的格式。 3. 创建相机参数对象(Intrinsic)并设置内参矩阵和畸变系数。 4. 创建点云对象(PointCloud)。 5. 遍历图像像素,将像素坐标转换为相机坐标,并计算图像点对应的深度值。 6. 将相机坐标系下的点转换为世界坐标系下的点。 7. 将世界坐标系下的点添加到点云对象中。 8. 使用 RandomSampling 进行下采样(可选)。 9. 进行相机标定,返回双目相机的外参矩阵(Extrinsic)和重投影误差。 10. 打印输出双目相机的外参矩阵和重投影误差。 以下是一个示例代码: ```python import open3d as o3d import numpy as np # 读取图像和深度图像 color_image = o3d.io.read_image("color_image.png") depth_image = o3d.io.read_image("depth_image.png") # 创建相机参数对象并设置内参矩阵和畸变系数 intrinsic = o3d.camera.PinholeCameraIntrinsic() intrinsic.set_intrinsics( color_image.width, color_image.height, focal_length_x, focal_length_y, principal_point_x, principal_point_y, radial_distortion, tangential_distortion ) # 创建点云对象 pointcloud = o3d.geometry.PointCloud() # 遍历图像像素,计算相机坐标和深度值 for row in range(color_image.height): for col in range(color_image.width): color = color_image[row, col] depth = depth_image[row, col] / 1000.0 # 将深度值转换为米 # 将像素坐标转换为相机坐标 cam_point = o3d.camera.PinholeCameraIntrinsic.backproject_pixel(intrinsic, [col, row], depth) # 将相机坐标转换为世界坐标 world_point = np.dot(intrinsic.intrinsic_matrix, cam_point) # 添加世界坐标到点云对象中 pointcloud.points.append(world_point) # 使用 RandomSampling 进行下采样 downsampled_pointcloud = pointcloud.voxel_down_sample(voxel_size=0.01) # 进行相机标定 extrinsic = downsampled_pointcloud.get_rotation_matrix_from_xyz() reprojection_error = downsampled_pointcloud.estimate_normals() # 打印输出外参矩阵和重投影误差 print("Extrinsic Matrix:", extrinsic) print("Reprojection Error:", reprojection_error) ``` 这只是一个简单的示例代码,具体实现可能因相机型号和使用的深度图像格式等而异。您需要根据实际情况调整代码。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值