ros下标定RGBD相机内参和外参

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hzwwpgmwy/article/details/81869472

系统:ubuntu14.04
ros版本: indigo
RGBD相机型号:asus xtion pro


深度测量原理
参考:https://wenku.baidu.com/view/3c5d90b658fb770bf78a55a0.html
通过红外发射器向固定深度( z 0 )平面投影,得到一幅散斑图案,将这幅散斑图案作为参考,当场景的深度改变时,散斑图案在像素平面的投影位置会发生变化,即得到散斑视差 d k ,然后利用该视差即可得到当前场景的深度 z k ,公式如下:

z k = z 0 1 + z 0 f b d k

固定参考量 z o f b 通过标定得到,即可通过上式进行求解.


安装openni相机ros驱动
参考: http://wiki.ros.org/openni2_launch

This package contains launch files for using OpenNI-compliant devices in ROS. It supports the Asus Xtion, Xtion Pro, and multiple version of the Primesense 1.08 and 1.09 cameras. It does NOT support any versions of the Kinect. freenect_launch or openni_launch is the recommended package for using a Kinect with ROS

可知我们需要使用openni2的驱动,对于kinect需要使用openni驱动

sudo apt-get install ros-indigo-rgbd-launch ros-indigo-openni2-camera ros-indigo-openni2-launch

接着报错

[ INFO] [1415845653.463960586]: Device "1d27/0609@1/12" with serial number "" connected

[ INFO] [1415845653.468566285]: No matching device found.... waiting for devices. Reason: openni2_wrapper::OpenNI2Device::OpenNI2Device(const string&) @ /tmp/buildd/ros-indigo-openni2-camera-0.2.2-0trusty-20141015-0837/src/openni2_device.cpp @ 74 : Initialize failed

    Could not open "1d27/0609@1/12": Failed to open the USB device!

解决:
创建udev规则: /etc/udev/rules.d/40-libopenni2-0.rules


SUBSYSTEM=="usb", ATTR{idProduct}=="0609", ATTR{idVendor}=="1d27", MODE:="0666", OWNER:="root", GROUP:="video"

加载规则,执行

sudo service udev reload 
sudo service udev restart

又报错,注意提示信息 Device "1d27/0609@3/12" found,说明已经找到该设备了,说明上一步成功了

[ INFO] [1534740129.364465286]: Initializing nodelet with 4 worker threads.
[ INFO] [1534740129.577934016]: Device "1d27/0609@3/12" found.
[ INFO] [1534740129.583657124]: No matching device found.... waiting for devices. Reason: openni2_wrapper::OpenNI2Device::OpenNI2Device(const string&) @ /tmp/binarydeb/ros-indigo-openni2-camera-0.4.0/src/openni2_device.cpp @ 75 : Device open failed
    Could not open "1d27/0609@3/12": Failed to open the USB device!

解决:
重新插拔相机USB口……


标定深度相机内参
参考: http://wiki.ros.org/openni_launch/Tutorials/IntrinsicCalibration

The speckle pattern makes it impossible to detect the checkerboard corners accurately in the IR image. The simplest solution is to cover the projector (lone opening on the far left) with one or two Post-it notes, mostly diffusing the speckles. An ideal solution is to block the projector completely and provide a separate IR light source. Good illumination sources include sunlight, halogen lamps, or incandescent lamps.

深度相机其实是加了一个红外线滤光片的普通相机,因此可以使用IR image检测棋盘格,堵住相机自带的红外发生器(因为它发射的是散斑,对红外图像会有影响),因此使用红外光源进行照射,日光、卤素灯或白炽灯都是常见的红外光源,注意LED光源是冷光源(比如,手机相机旁边那个闪光灯)

注意: RGBD相机不能同时输出IR图像和RGB图像

The Kinect camera driver cannot stream both IR and RGB images. It will decide which of the two to stream based on the amount of subscribers, so kill nodes that subscribe to RGB images before doing the IR calibration.


depth相机与RGB相机外参标定
参考:Kinect_Tutorial/Tutorial/Kinect相机标定calibration.md

1) depth相机与built-in RGB相机标定
参考教程:http://wiki.ros.org/openni_launch/Tutorials/ExtrinsicCalibration

2) depth相机与external RGB相机标定
参考:http://wiki.ros.org/openni_launch/Tutorials/ExtrinsicCalibrationExternal
使用的是camera_pose_calibration这个包

注意:external RGB相机要与depth相机的位置尽可能的近,这样重叠区域才多


<完>
@leatherwang


猜你喜欢

转载自blog.csdn.net/hzwwpgmwy/article/details/81869472