RGBD图像和深度图对齐

本文为个人笔记,可能对大家帮助不大
相机:Xvisio
目的:获取同一坐标系下的深度图和RGB图像

首先根据给出的read_calibration sample把灰度相机改成RGB和TOF相机,得到两个相机的外参和内参

Stereo:彩色相机
Calibration:
 R:[0.999942, -0.0105642, 0.00221015, 0.0106091, 0.999714, -0.0214202, -0.00198323, 0.0214424, 0.999768]
 T: [0.00129305, -0.000780199, 0.0647487]
PDCM0: {w=640, h=480, fx=481.111, fy=481.111, u0=319.016, v0=240.671, distor=[0.177849, -0.584516, 2.02086e-05, -0.00123024, 0.557474]}
PDCM1: {w=1280, h=720, fx=966.287, fy=966.287, u0=638.449, v0=360.194, distor=[0.186443, -0.656735, 0.000809626, -0.00164232, 0.669914]}
PDCM2: {w=1920, h=1080, fx=1420.9, fy=1420.9, u0=941.479, v0=541.334, distor=[0.185723, -0.642745, 0.00136189, -0.00111005, 0.634922]}


Stereo:TOF相机
Calibration:
 R:[-0.99996, 0.00648826, -0.00616031, -0.00632826, -0.999651, -0.025646, -0.00632456, -0.025606, 0.999652]
 T: [-0.0165595, -0.000393681, 0.0625978]
PDCM0: {w=224, h=172, fx=193.894, fy=193.894, u0=111.756, v0=86.6579, distor=[0.297176, -1.9614, -0.00178154, -0.000141994, 3.61719]}

可视化的几个指令

roslaunch xv_sdk xv_sdk.launch	
rosrun rviz rviz -d `rospack find xv_sdk`/rviz/demo.rviz
xslam-viewer

用rosbag record -a 录制数据包
rosbag info
RGBD图像和深度图对齐_第1张图片
先写一个ros程序把对应的图片读取出来, topic 为

/xv_sdk/xv_dev/color_camera/image_color

/xv_sdk/xv_dev/tof_camera/image

运行提取图片的脚本

python get_depth_rgb_from_rosbag.py
    from cv_bridge.boost.cv_bridge_boost import getCvType
ImportError: dynamic module does not define module export function (PyInit_cv_bridge_boost)

报错参考:链接

这个相机输出的深度图貌似是8位的(后边验证是32位的)
RGBD图像和深度图对齐_第2张图片
RGBD图像和深度图对齐_第3张图片
下一步要把RGB图像映射到深度图上

R_dep
 [[-0.99996     0.00648826 -0.00616031]
 [-0.00632826 -0.999651   -0.025646  ]
 [-0.00632456 -0.025606    0.999652  ]] 

t_dep
 [[-0.0165595 ]
 [-0.00039368]
 [ 0.0625978 ]] 

R_rgb
 [[ 0.999942   -0.0105642   0.00221015]
 [ 0.0106091   0.999714   -0.0214202 ]
 [-0.00198323  0.0214424   0.999768  ]] 

t_rgb
 [[ 0.00129305]
 [-0.0007802 ]
 [ 0.0647487 ]] 

R_dep2rgb
 [[-0.99998416  0.00417594 -0.00384431]
 [-0.00399032 -0.99888289 -0.04707852]
 [-0.00403661 -0.04706242  0.99888357]] 

R_dep2rgb
 [[-0.0150239 ]
 [ 0.00170749]
 [ 0.00213541]] 

R_rgb2dep
 [[-0.99998416 -0.00399032 -0.00403661]
 [ 0.00417594 -0.99888289 -0.04706242]
 [-0.00384431 -0.04707852  0.99888357]] 

T_rgb2dep
 [[-0.01500822]
 [ 0.00186882]
 [-0.00211037]] 

PCL出了一些问题,通过参考链接安装

编译

catkin_make -DXVSDK_INCLUDE_DIRS="/usr/include/xvsdk" -DXVSDK_LIBRARIES="/usr/lib/libxvsdk.so"

source  devel/setup.bash
rosrun cloud2rgb cloud2rgb

投影出来的尺寸,感觉不太对

max:580,420
min:93,25

用了蛮久发现x,y的顺序搞错了
RGBD图像和深度图对齐_第4张图片
基本上问题解决了,相机的分辨率不太对,找技术聊了一下,应该是固件老了,后边更换固件之后再试试。

你可能感兴趣的:(位姿估计,激光雷达/相机,深度学习,ar,python)