方法简介
所提出的方法既不受系统中摄像头数量的限制,也不受它们重叠的视场的限制。此外,可以使用任意数量的棋盘格和3D校准对象(由一组平面校准目标组成)来执行摄像头参数的估计。在其当前形式下,它只能利用Charuco标记。
算法流程
1)对所有摄像头获取的图像中的棋盘格进行检测,并存储检测到的2D位置。
2)这些2D观测值及其相应的3D位置(在其棋盘格参考系中表示)用于初始化每个摄像头的内在参数。
3)在校准摄像头的内在参数之后,通过透视n点技术估计每个摄像头相对于观测到的棋盘格的姿态。
4)计算单张图像中可见的所有棋盘格之间的板间变换,以将共同可见的棋盘格合并为3D对象(一个3D对象是一组3D棋盘格)。
5)在细化了3D对象结构之后,通过基于图的策略,将观察到相似3D对象的摄像头分组。在这个阶段,如果系统中的所有摄像头都共享全局或非全局重叠的视场,则通过最终的捆绑调整完成校准。如果仍有多个摄像头组存在,则在每对组之间执行非重叠摄像头组校准。这个估计用于在获得整个摄像头系统的所有参数之前,合并所有摄像头组和3D对象。
关键代码
暂时不对外开放
程序启用
准备工作
1)生成自己需要的Charuco标定板
./apps/create_charuco_boards/generate_charuco ../configs/calib_param.yml
2)打印标定板
3)测量标定板的正方形尺寸
4)获取图像
5)保存图像
从每个相机提取的图像必须存储在不同的文件夹中,文件夹中有一个公共前缀,后面跟着一个三位数的索引(从001开始)。例如,如果使用两个相机,则可以将文件夹称为:“Cam_001”和“Cam_002”。
6)设置相应配置文件
设置摄像头数量和摄像头类型:
必须在“number_camera”字段中指定要校准的摄像机数量。
如果正在校准同质相机系统,可以使用“distortion_model”指定相机类型:“0”表示相机都是透视的(棕色失真模型),“1”将使用Kannala失真模型(鱼眼)。
如果正在校准混合视觉系统(由鱼眼相机和透视相机组成),则需要指定要在“distortion_per_camera”中使用的失真模型类型。
设置图像路径:
需要在字段“root_path”中指定图像存储的文件夹,例如“…/Data/Image_folder/”。
设置输出:
默认情况下,MC Calib将为检测到的每个帧生成相机校准结果、重投影错误日志、3D对象结构、检测到的关键点以及对象的姿势。此外,可以通过将“save_detection”和“save_reprojection”设置为“1”来保存检测和重投影图像。
仅使用某些板:
如果准备了大量校准对象,但只有少数校准对象出现在校准序列中,则可以在“boards_index”中指定板索引列表。指定板索引可以避免检测所有板,并将加快校准速度。
高级设置:
对于一般校准设置,出于稳健性考虑,建议将“min_perc_pts”设置为至少0.4(应考虑板上40%的点)。然而,在与单个板重叠的有限视场的校准的情况下,该参数可以显著降低。
默认情况下,这些参数可以正确校准系统,但如果需要可以调整它们。这些参数在配置文件中进行了描述。
运行
1)运行标定程序
./apps/calibrate/calibrate ../configs/calib_param.yml
标定配置文件注释
######################################## Boards Parameters ###################################################
number_x_square: 5 # number of squares in the X direction
number_y_square: 5 # number of squares the Y direction
resolution_x: 500 # horizontal resolution in pixel
resolution_y: 500 # vertical resolution in pixel
length_square: 0.04 # parameters on the marker (can be kept as it is)
length_marker: 0.03 # parameters on the marker (can be kept as it is)
number_board: 3 # number of boards used for calibration (for overlapping camera 1 is enough ...)
boards_index: [] # leave it empty [] if the board index are ranging from zero to number_board; example of usage boards_index: [5,10 <-- only two board with index 5/10
square_size: 0.192 # size of each square of the board in cm/mm/whatever you want
############# Boards Parameters for different board size (leave empty if all boards have the same size) #################
number_x_square_per_board: []
number_y_square_per_board: []
square_size_per_board: []
######################################## Camera Parameters ###################################################
distortion_model: 0 # 0:Brown (perspective) // 1: Kannala (fisheye)
distortion_per_camera : [] # specify the model per camera, #leave "distortion_per_camera" empty [] if they all follow the same model (make sure that the vector is as long as cameras nb)
number_camera: 2 # number of cameras in the rig to calibrate
refine_corner: 1 # activate or deactivate the corner refinement
min_perc_pts: 0.5 # min percentage of points visible to assume a good detection
cam_params_path: "None" # file with cameras intrinsics to initialize the intrinsic, write "None" if no initialization available
######################################## Images Parameters ###################################################
root_path: "../data/Synthetic_calibration_image/Scenario_1/Images/"
cam_prefix: "Cam_"
keypoints_path: "None" # "path_to/detected_keypoints_data.yml" to save time on keypoint detection
######################################## Optimization Parameters #############################################
quaternion_averaging: 1 # use Quaternion Averaging or median for average rotation
ransac_threshold: 10 # RANSAC threshold in pixel (keep it high just to remove strong outliers)
number_iterations: 1000 # Max number of iterations for the non linear refinement
######################################## Hand-eye method #############################################
he_approach: 0 #0: bootstrapped he technique, 1: traditional he
######################################## Output Parameters ###################################################
save_path: "experiments/Synthetic_calibration_image/Scenario_1/"
save_detection: 1
save_reprojection: 1
camera_params_file_name: "" # "name.yml"
标定自动输出四个*.yml文件
Camera parameters: calibrated_cameras_data.yml
%YAML:1.0
---
nb_camera: 2
camera_0: # all the calibration parameters (intrinsic/extrinsic) for the camera 0
camera_matrix: !!opencv-matrix # 3x3 intrinsic matrix
rows: 3
cols: 3
dt: d
data: [ 6.9057886528642052e+02, 0., 6.5114341701043156e+02, 0.,
6.8919862105007201e+02, 2.6741231181725999e+02, 0., 0., 1. ]
distortion_vector: !!opencv-matrix # 1x5 distortion vector (Brown model here)
rows: 1
cols: 5
dt: d
data: [ -5.5592652556282401e-02, 1.2691061778374907e-01,
-2.4976766901851363e-04, 1.1847248726536302e-03,
-6.7785776099559991e-02 ]
distortion_type: 0 # type of distortion model (0: perspective, 1: fisheye)
camera_group: 0 #Camera group in which this camera belong, if the calibration has been sucessful, all camera should belong to the group 0
img_width: 1280 #image size
img_height: 512
camera_pose_matrix: !!opencv-matrix
rows: 4
cols: 4
dt: d
data: [ 1., 0., 0., 0., 0., 1., 0., 0., 0., 0., 1., 0., 0., 0., 0.,
1. ] #4x4 extrinsic matrix (for camera 0, it is the identity because it is the reference)
camera_1: # all the calibration parameters (intrinsic/extrinsic) for the camera 1
camera_matrix: !!opencv-matrix # 3x3 intrinsic matrix for camera 1
rows: 3
cols: 3
dt: d
data: [ 3.3467577884661034e+02, 0., 6.3270889699552083e+02, 0.,
3.3407723815119016e+02, 2.6650518594457941e+02, 0., 0., 1. ]
distortion_vector: !!opencv-matrix # 1x4 distortion vector (fisheye model)
rows: 1
cols: 4
dt: d
data: [ 1.1763357579105141e-02, -5.1797112353852174e-03,
2.6315580610037459e-03, 0. ]
distortion_type: 1 # type of distortion model (0: perspective, 1: fisheye)
camera_group: 0
img_width: 1280
img_height: 512
camera_pose_matrix: !!opencv-matrix #4x4 extrinsic matrix
rows: 4
cols: 4
dt: d
data: [ 9.9999074801577947e-01, 7.7896180494682642e-04,
-4.2304965841050025e-03, 1.9839157514973714e+01,
-7.9020195036245652e-04, 9.9999616084980592e-01,
-2.6559116188004227e-03, 6.1882118248103253e-02,
4.2284114888848610e-03, 2.6592299929997965e-03,
9.9998752443824268e-01, 1.8600285922272908e+00, 0., 0., 0., 1. ] #4x4 extrinsic matrix, expressed in camera 0 referencial
Object 3D structure: calibrated_objects_data.yml
%YAML:1.0
---
object_0: #object index (if all boards have been seen, a single object should exist)
points: !!opencv-matrix #3xn 3D structure of the object
rows: 3
cols: 16
dt: f
data: [ 0., 9.14999962e+00, 1.82999992e+01, 2.74499989e+01, 0.,
9.14999962e+00, 1.82999992e+01, 2.74499989e+01, 0.,
9.14999962e+00, 1.82999992e+01, 2.74499989e+01, 0.,
9.14999962e+00, 1.82999992e+01, 2.74499989e+01, 0., 0., 0., 0.,
9.14999962e+00, 9.14999962e+00, 9.14999962e+00, 9.14999962e+00,
1.82999992e+01, 1.82999992e+01, 1.82999992e+01, 1.82999992e+01,
2.74499989e+01, 2.74499989e+01, 2.74499989e+01, 2.74499989e+01,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0. ]
Object’s poses: calibrated_objects_pose_data.yml
该文件中提供了对象相对于参考相机的姿态(对于所有可见板的帧),作为6xn阵列。每行包含罗德里格斯角轴(3个浮动)和平移矢量(3个浮点数)。
Reprojection error log: reprojection_error_data.yml
每个角、相机和帧的重投影错误。
注:读取这些文件的python代码示例在``python_utils中提供```

7905

被折叠的 条评论
为什么被折叠?



