赞
踩
Camera Calibration
https://blog.csdn.net/u012871872/article/details/78083299
本文暂时使用 小觅相机,介绍相机内参,相机与imu之间的外参
ROS 中的相机传感器数据,关于相机信息的格式:sensor_msgs/CameraInfo
详细见下面的 官方链接:
http://docs.ros.org/melodic/api/sensor_msgs/html/msg/CameraInfo.html
使用 kalibr 标定
标定板类型有
kalibr_create_target_pdf --type apriltag --nx 6 --ny 6 --tsize 0.02 --tspace 0.3
kalibr_create_target_pdf --type checkerboard --nx 6 --ny 6 --csx 0.02 --csy 0.02
运行上述命令会在当前目录下,生成 target.pdf
本文选择 apriltag 精度高,然后按实际大小打印,或者直接用电脑按实际大小显示。
启动相机驱动,左右目图像的发布帧率在20到60hz;若直接采集,导致计算量过大,于是需要降低采集频率,使用ros控制话题发布频率的工具 throttle 节点
rosrun topic_tools throttle messages /mynteye/left/image_raw 4.0 /left
rosrun topic_tools throttle messages /mynteye/right/image_raw 4.0 /right
录制
rosbag record -O stereo_calibra.bag /left /right
使用相机对标定板拍摄,大概1分钟
标定命令行中 还需要 标定板的参数,创建 aprilgrid-6_6-2.cm-0.6cm.yaml 文件
target_type: 'aprilgrid' #gridtype
tagCols: 6 #number of apriltags
tagRows: 6 #number of apriltags
tagSize: 0.02 #size of apriltag, edge to edge [m]
tagSpacing: 0.3 #ratio of space between tags to tagSize
标定运行命令
加上 --show-extraction 参数,显示特征提取情况
kalibr_calibrate_cameras --bag /home/chewgum/visual_slam/stereo_calibra.bag --topics /left /right --models pinhole-radtan pinhole-radtan --target /home/chewgum/visual_slam/aprilgrid-6_6-2.cm-0.6cm.yaml --show-extraction
出现问题
:
Cameras are not connected through mutual observations, please check the dataset. Maybe adjust the approx. sync. tolerance.
在上面的标定命令行加上 --approx-sync 0.1 ,将两帧之间的时间同步容忍度加大到0.1s; 或者改变前面录制bag包的频率,从原来的4hz 调整到 20hz。
camchain-homechewgumvisual_slamstereo_calibra.yaml
cam0:
cam_overlaps: [1]
camera_model: pinhole
distortion_coeffs: [-0.29493438147961343, 0.07522888381593014, -0.0018319624616570107,
-0.002356088773962833]
distortion_model: radtan
intrinsics: [364.24637873978213, 366.457071766116, 387.4921108720392, 238.7839064461657]
resolution: [752, 480]
rostopic: /mynteye/left/image_raw
cam1:
T_cn_cnm1:
- [0.9999076175962174, 0.0033106420159252216, 0.013183168150762868, -0.12038398571176612]
- [-0.0032542977725930626, 0.9999854892539586, -0.004293113965493399, 0.00023786133727843532]
- [-0.01319718981663118, 0.004249815402556823, 0.9999038820056557, 0.0002842556792255972]
- [0.0, 0.0, 0.0, 1.0]
cam_overlaps: [0]
camera_model: pinhole
distortion_coeffs: [-0.3236731263843389, 0.10834524230255492, -0.00159531254814612,
0.0006582173691789835]
distortion_model: radtan
intrinsics: [364.68177731090765, 367.14971555045713, 389.6805771084146, 260.53738481605325]
resolution: [752, 480]
rostopic: /mynteye/right/image_raw
使用calibration validator进行标定结果的验证,原理是对重投影误差进行量化分析。命令行如下:
kalibr_camera_validator --cam camchain.yaml --target target.yaml
命令行中 camchain.yaml 与 target.yaml 分别为上述中camera标定的结果以及 标定板的yaml文件。
保证imu 的频率200 hz , camera的频率为 20hz
EuRoC数据集,其rosbag,imu的频率为200hz,相机频率为20hz; 所以小觅相机,参数配置文件也要设定为一样的。(毕竟知名数据集的设置是这样的;小觅相机的图像频率默认是10hz,所以需要修改一下)
修改之后的小觅相机驱动参数中 imu 的频率200 hz , camera的频率为 20hz,所以不需要再修改频率,可以直接录制
roslaunch mynt_eye_ros_wrapper display.launch
rosrun topic_tools throttle messages /mynteye/imu/data_raw 200 /imu
rosrun topic_tools throttle messages /mynteye/left/image_raw 20 /left
rosrun topic_tools throttle messages /mynteye/right/image_raw 20 /right
录制
rosbag record -O stereo+imu_calibra.bag /left /right /imu
或
rosbag record -O stereo+imu_calibra.bag /mynteye/imu/data_raw /mynteye/left/image_raw /mynteye/right/image_raw
录制运动具体可以参照kalibr的视频,视频中是先面对标定目标,然后俯仰、偏航和横滚三个角度分别面向目标运动,然后是前后左右和上下运动,充分运动起来, 绕8字。时间一分钟即可
创建imu参数文件:mynt_imu_kalibr_format.yaml ;imu的标定见上一讲
#Accelerometers
accelerometer_noise_density: 1.1306635200120034e-02 #Noise density (continuous-time)
accelerometer_random_walk: 5.6369851835317642e-04 #Bias random walk
#Gyroscopes
gyroscope_noise_density: 1.0690087672934289e-03 #Noise density (continuous-time)
gyroscope_random_walk: 1.0895815866105891e-05 #Bias random walk
rostopic: /mynteye/imu/data_raw #the IMU ROS topic
update_rate: 200.0 #Hz (for discretization of the values above)
相机内参文件 :上面双目标定结果 camchain-homechewgumvisual_slamstereo_calibra.yaml
cam0:
cam_overlaps: [1]
camera_model: pinhole
distortion_coeffs: [-0.29493438147961343, 0.07522888381593014, -0.0018319624616570107,
-0.002356088773962833]
distortion_model: radtan
intrinsics: [364.24637873978213, 366.457071766116, 387.4921108720392, 238.7839064461657]
resolution: [752, 480]
rostopic: /mynteye/left/image_raw
cam1:
T_cn_cnm1:
- [0.9999076175962174, 0.0033106420159252216, 0.013183168150762868, -0.12038398571176612]
- [-0.0032542977725930626, 0.9999854892539586, -0.004293113965493399, 0.00023786133727843532]
- [-0.01319718981663118, 0.004249815402556823, 0.9999038820056557, 0.0002842556792255972]
- [0.0, 0.0, 0.0, 1.0]
cam_overlaps: [0]
camera_model: pinhole
distortion_coeffs: [-0.3236731263843389, 0.10834524230255492, -0.00159531254814612,
0.0006582173691789835]
distortion_model: radtan
intrinsics: [364.68177731090765, 367.14971555045713, 389.6805771084146, 260.53738481605325]
resolution: [752, 480]
rostopic: /mynteye/right/image_raw
命令行:
kalibr_calibrate_imu_camera --target /home/chewgum/visual_slam/aprilgrid-6_6-2.cm-0.6cm.yaml --cam /home/chewgum/visual_slam/camchain-homechewgumvisual_slamstereo_calibra.yaml --imu /home/chewgum/visual_slam/imu_utils/src/imu_utils/data/mynt_imu_kalibr_format.yaml --bag /home/chewgum/visual_slam/stereo+imu_calibra.bag --bag-from-to 5 50
参数:
- –bag-from-to : --bag-from-to 5 50 取bag 5秒到50秒的数据播放;先要查看一下bag包本身的时长;
camchain-imucam-homechewgumvisual_slamstereo+imu_calibra.yaml
cam0:
T_cam_imu:
- [-0.003250347682917931, 0.999969585040646, -0.007089727327536899, 0.042032434603335195]
- [-0.9999921462110681, -0.0032663356374186825, -0.002244675407753127, 0.00029240263719737823]
- [-0.002267764565071351, 0.007082375670804389, 0.9999723482170573, -0.026176639544284192]
- [0.0, 0.0, 0.0, 1.0]
cam_overlaps: [1]
camera_model: pinhole
distortion_coeffs: [-0.29493438147961343, 0.07522888381593014, -0.0018319624616570107,
-0.002356088773962833]
distortion_model: radtan
intrinsics: [364.24637873978213, 366.457071766116, 387.4921108720392, 238.7839064461657]
resolution: [752, 480]
rostopic: /mynteye/left/image_raw
timeshift_cam_imu: 0.006738289134998647
cam1:
T_cam_imu:
- [-0.0065905597444152475, 0.9999597599280499, 0.006086299934457427, -0.07869955716605419]
- [-0.9999573222080451, -0.006550892479611714, -0.006514566005225936, 0.0005058529699863603]
- [-0.006474433162151864, -0.0061289748210814265, 0.9999602579017186, -0.02644333517965107]
- [0.0, 0.0, 0.0, 1.0]
T_cn_cnm1:
- [0.9999076175962189, 0.0033106420159252216, 0.01318316815076287, -0.12038398571176612]
- [-0.0032542977725930626, 0.9999854892539601, -0.004293113965493399, 0.00023786133727843532]
- [-0.013197189816631181, 0.004249815402556823, 0.9999038820056573, 0.0002842556792255972]
- [0.0, 0.0, 0.0, 1.0]
cam_overlaps: [0]
camera_model: pinhole
distortion_coeffs: [-0.3236731263843389, 0.10834524230255492, -0.00159531254814612,
0.0006582173691789835]
distortion_model: radtan
intrinsics: [364.68177731090765, 367.14971555045713, 389.6805771084146, 260.53738481605325]
resolution: [752, 480]
rostopic: /mynteye/right/image_raw
timeshift_cam_imu: 0.006824621396683813
VIO标定(一)针孔相机模型 :https://zhuanlan.zhihu.com/p/93819559
相机坐标系 到 归一化平面
相机模型指的是相机坐标系到理想图像平面(通常也称为Normalize 平面/归一化平面)的投影模型
设相机坐标系下的点为 ( x c , y c , z c ) (x_c ,y_c ,z_c) (xc,yc,zc), 投影到normalize平面/归一化平面的点为 ( x u , y u ) (x_u,y_u) (xu,yu)
包含:
归一化平面 到真实图像平面
理想的针孔成像模型确定的坐标变换关系均为线性的,而实际上,现实中使用的相机由于镜头中镜片因为光线的通过产生的不规则的折射,镜头畸变(lens distortion)总是存在的,即根据理想针孔成像模型计算出来的像点坐标与实际坐标存在偏差。
畸变模型有:
小觅相机官方使用的畸变模型也是鱼眼畸变模型 distortion_model: KANNALA_BRANDT ;./samples/_output/bin/get_img_params 可以查看
目前接触的相机去畸变参数:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。