实验背景:因为需要制作bundlefusion需要的数据集,所以需要使用kinectV2相机获取rgbd图像,年前的时候在我的笔记本上安装了libfreenect2库和iai_kinect2,标定过一次kinecv2相机,然后使用kinectv2相机实时获取的图像实现elasticfusion稠密重建.但是由于当时时间紧迫,很多东西都没有搞明白,所以趁这次机会将一些问题整理一下,记录一下.

环境搭建:

1. 安装了ROS的kinetic版本

libfreenect2和iai_kinect2的安装参考文章: https://www.cnblogs.com/li-yao7758258/p/7445429.html

2. 下载libfreenect2

$ cd Downloads
$ git clone https://github.com/OpenKinect/libfreenect2.git

3.安装libfreenect2的依赖

sudo apt-get install build-essential cmake pkg-config libturbojpeg libjpeg-turbo8-dev mesa-common-dev freeglut3-dev libxrandr-dev libxi-dev安装libusb
sudo apt-add-repository ppa:floe/libusb
sudo apt-get update
sudo apt-get install libusb-1.0-0-dev安装GLFW3
cd libfreenect2/depends
sh install_ubuntu.sh
sudo dpkg -i libglfw3*_3.0.4-1_*.deb

4.  继续安装libfreenect2库

$ cd libfreenect2
$ mkdir build
$ cmake ../
$ make -j4
$ sudo make install

5. 使用lsusb指令测试kinectv2相机有没有链接成功.

6. 编译iai_kinect2

$ cd ~/ROS  #在/home/yunlei下创建了一个ROS文件夹,专门盛放ros的工程
$ mkdir -r ./iai_kinect2_ws/src/
$ cd ./iai_kinect2/src
$ git clone https://github.com/code-iai/iai_kinect2.git
$ cd iai_kinect2
$ rosdep install -r --from-paths .
$ cd ~/ROS/iai_kinect2
$ catkin_make -DCMAKE_BUILD_TYPE="Release"
$ rospack profile

7. 测试kinectv2相机是否链接成功

$ cd Download
$ cd libfreenect
$ cd build/bin
$ ./Protonect

如果一切正常的话,相机拍摄的画面将映入眼帘.

8. 测试kinectv2图像数据

$ cd ~/ROS/iai_kinect2_ws
$ source ./devel/setup.bash
$ roslaunch kinect2_bridge kinect2_bridge.launch# open a new terminal
$  rosrun kinect2_viewer kinect2_viewer(但是我这里执行失败)

9. 查看此时发布的与kinect相关的topics

/kinect2/bond
/kinect2/hd/camera_info
/kinect2/hd/image_color
/kinect2/hd/image_color/compressed
/kinect2/hd/image_color_rect
/kinect2/hd/image_color_rect/compressed
/kinect2/hd/image_depth_rect
/kinect2/hd/image_depth_rect/compressed
/kinect2/hd/image_mono
/kinect2/hd/image_mono/compressed
/kinect2/hd/image_mono_rect
/kinect2/hd/image_mono_rect/compressed
/kinect2/hd/points
/kinect2/qhd/camera_info
/kinect2/qhd/image_color
/kinect2/qhd/image_color/compressed
/kinect2/qhd/image_color_rect
/kinect2/qhd/image_color_rect/compressed
/kinect2/qhd/image_depth_rect
/kinect2/qhd/image_depth_rect/compressed
/kinect2/qhd/image_mono
/kinect2/qhd/image_mono/compressed
/kinect2/qhd/image_mono_rect
/kinect2/qhd/image_mono_rect/compressed
/kinect2/qhd/points
/kinect2/sd/camera_info
/kinect2/sd/image_color_rect
/kinect2/sd/image_color_rect/compressed
/kinect2/sd/image_depth
/kinect2/sd/image_depth/compressed
/kinect2/sd/image_depth_rect
/kinect2/sd/image_depth_rect/compressed
/kinect2/sd/image_ir
/kinect2/sd/image_ir/compressed
/kinect2/sd/image_ir_rect
/kinect2/sd/image_ir_rect/compressed
/kinect2/sd/points

10. 打开/home/yunlei/ROS/iai_kinect2_ws/src/iai_kinect2/kinect2_bridge/launch/kinect2_bridge.launch查看kinect相机的分辨率

 <!-- sd point cloud (512 x 424) --><node pkg="nodelet" type="nodelet" name="$(arg base_name)_points_xyzrgb_sd" machine="$(arg machine)"args="load depth_image_proc/point_cloud_xyzrgb $(arg nodelet_manager)" respawn="$(arg respawn)"><remap from="rgb/camera_info"             to="$(arg base_name)/sd/camera_info"/><remap from="rgb/image_rect_color"        to="$(arg base_name)/sd/image_color_rect"/><remap from="depth_registered/image_rect" to="$(arg base_name)/sd/image_depth_rect"/><remap from="depth_registered/points"     to="$(arg base_name)/sd/points"/><param name="queue_size" type="int" value="$(arg queue_size)"/></node><!-- qhd point cloud (960 x 540) --><node pkg="nodelet" type="nodelet" name="$(arg base_name)_points_xyzrgb_qhd" machine="$(arg machine)"args="load depth_image_proc/point_cloud_xyzrgb $(arg nodelet_manager)" respawn="$(arg respawn)"><remap from="rgb/camera_info"             to="$(arg base_name)/qhd/camera_info"/><remap from="rgb/image_rect_color"        to="$(arg base_name)/qhd/image_color_rect"/><remap from="depth_registered/image_rect" to="$(arg base_name)/qhd/image_depth_rect"/><remap from="depth_registered/points"     to="$(arg base_name)/qhd/points"/><param name="queue_size" type="int" value="$(arg queue_size)"/></node><!-- hd point cloud (1920 x 1080) --><node pkg="nodelet" type="nodelet" name="$(arg base_name)_points_xyzrgb_hd" machine="$(arg machine)"args="load depth_image_proc/point_cloud_xyzrgb $(arg nodelet_manager)" respawn="$(arg respawn)"><remap from="rgb/camera_info"             to="$(arg base_name)/hd/camera_info"/><remap from="rgb/image_rect_color"        to="$(arg base_name)/hd/image_color_rect"/><remap from="depth_registered/image_rect" to="$(arg base_name)/hd/image_depth_rect"/><remap from="depth_registered/points"     to="$(arg base_name)/hd/points"/><param name="queue_size" type="int" value="$(arg queue_size)"/>

可以发现kinecv2相机可以直接获取的图像的分辨率有三个,分别是:hd(1920x1080), qhd(960x540), sd(512x424),每一种分辨率又对应了彩色图,灰度图,深度图,以及是否是经过去畸变处理的,深度图是否和彩色图配准.

11. 如果你想获取rect图像,那么你需要给定相应分辨率的相机内参数,而此时使用的是默认/iai_kinect2/kinect2_bridge/data下的相机参数,所以你需要标定你需要的分辨率的相机参数.

12.关于数据获取,如果我标定了960x540的相机内参数,获取了去畸变后的而图像,我直接使用rosbag record指令,录制相应的topic就可以了.所以现在最关键的是标定相机

13. iai_kinect2中也提供了标定工具,在/home/yunlei/ROS/iai_kinect2_ws/src/iai_kinect2/kinect2_calibration中,不过此时在/home/yunlei/ROS/iai_kinect2_ws/src/iai_kinect2/kinect2_calibration/src/kinect2_calibration.cpp文件中默认是标定1920x1080的图像,如果想要标定960x540的相机内参数,则需要将文件1349行中的HD改为QHD

将原来的

std::string topicColor = "/" + ns + K2_TOPIC_HD + K2_TOPIC_IMAGE_MONO;
std::string topicIr = "/" + ns + K2_TOPIC_SD + K2_TOPIC_IMAGE_IR;
std::string topicDepth = "/" + ns + K2_TOPIC_SD + K2_TOPIC_IMAGE_DEPTH;

改为

std::string topicColor = "/" + ns + K2_TOPIC_QHD + K2_TOPIC_IMAGE_MONO;
std::string topicIr = "/" + ns + K2_TOPIC_SD + K2_TOPIC_IMAGE_IR;
std::string topicDepth = "/" + ns + K2_TOPIC_SD + K2_TOPIC_IMAGE_DEPTH;

我刚开始改成了SD但是这种情况下,当你执行rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 record color指令时,没有弹出图像窗口,无法保存图像,并且提示

[ERROR] Tried to advertise a service that is already advertised in this node [/kinect2_calib_1591865100768222736/compressed/set_parameters]
[ERROR] Tried to advertise a service that is already advertised in this node [/kinect2_calib_1591865100768222736/compressed/set_parameters]

我刚开始根据这个错误提示去搜索出了什么问题,但是有网友说这个不影响标定,(https://blog.csdn.net/weixin_30536513/article/details/94969881)但是我这里确实影响了.我折腾了好久,但是还是没有解决这个问题,当我想放弃的时候,突然想起来,我可以把上面的SD改为QHD试试.果然,当我改成了QHD后发现,虽然还是会有上面的错误的提示,但是此时弹出了图像窗口,当我拿着标定板进入相机的视野时,他可以检测到标定板子上的特征点,哇,我好开心.

使用iai_kinect2标定kinectV2相机相关推荐

  1. ROS下获取kinectv2相机的仿照TUM数据集格式的彩色图和深度图

    准备工作: 1. ubuntu16.04上安装iai-kinect2, 2. 运行roslaunch kinect2_bridge kinect2_bridge.launch, 3. 运行 rosru ...

  2. ROS获取KinectV2相机的彩色图和深度图并制作bundlefusion需要的数据集

    背景: 最近在研究BundleFusion,跑通官方数据集后,就想着制作自己的数据集来运行bundlefusion.KinectV2相机可直接获取的图像的分辨率分为三个HD 1920x1080, QH ...

  3. 相机标定篇——相机标定

    认为相机标定是三维重建的核心,研究生期间主要方向为结构光三维重建 必要的数学知识 线性方程求解 Gauss消元法:LU分解:Cholesky分解 最小二乘问题-线性方法 特征值分解:奇异值分解:超定线 ...

  4. Ubuntu16.04 在ROS中配置RealSence D435 并标定深度相机与rplidar外参

    Ubuntu16.04系统,在ROS中配置RealSence D435 ,并标定其与rplidar的外参 主要目的是为rplidar标定深度相机外参,为机器人导航的过程提供障碍物识别的功能,因此需要知 ...

  5. 工业现场相机坐标系和机械手坐标系的标定(1)-相机和机械手分离的情况

    工业现场使用视觉时一般需要相机坐标系和机械手臂坐标系的转化,这里介绍一种比较简单的标定方案.没有使用到标定板.经过几个项目的测试,精度还算可以,如果要求高精度的场合,就用标定板标定吧![可以购买专用的 ...

  6. 相机标定:相机模型和畸变模型

    一.相机标定方案 相机内参标定是确定内参和畸变参数(equidistqant畸变模型)或者(radial tangential模型)的过程. 本文首先介绍SLAM中常用的相机模型和畸变模型,随后介绍我 ...

  7. 标定iphone相机_iPhone X的相机更好吗?

    标定iphone相机 While the iPhone X's design is its biggest talking point, the thing that really caught my ...

  8. 使用标定板对相机位姿进行估计

    使用标定板几个特定的点,来对相机相对标定板平面进行位姿估计. 首先进行相机的畸变校正,之后同个各个标定板间的圆点距离进行位姿估计. gen_caltab (7, 7, 0.002, 0.5, 'C:/ ...

  9. 用matlab对相机进行标定获取相机内参

    常见的相机标定方式是张正友的棋盘格标定法,即用相机拍摄打印好的棋盘格图图像,将图像传入函数计算出相机的内参数据. 本文讲解的是将相机直接连接电脑,用matlab的相机标定工具箱通过相机实时采集一定数量 ...

最新文章

  1. 使用 Global.asax 文件
  2. 计算机知识课后反思,计算机硬件和软件知识课后反思
  3. ballgown包进行基因差异表达分析
  4. python是如何登上编程语言排行榜榜首的
  5. 在 Laravel 应用中使用 pjax 进行页面加速
  6. 面向切面编程:操作日志
  7. 如何看待不会写代码的架构师?
  8. mt6765和骁龙665哪个好_华为都把骁龙850用在了自家的win10设备上了,麒麟还会远吗?...
  9. arcgis构建金字塔失败什么原因_新西兰创业移民转永居失败!原因是什么?
  10. 基于卷积神经网络的mnist手写体识别
  11. HCIE-Cloud题库
  12. 抖音直播引流的最快方法是什么?就简单两招破500人!
  13. 网络安全现状及防范措施
  14. Parallel Scavenge收集器
  15. 这27个电源符号,还傻傻分不清楚?
  16. Android自定义折线图,可设置基准线,不同点颜色
  17. java圈子_从JAVA入了这个圈子,有多少老司机和他一样?
  18. API入门系列之五 -一个正儿八经的SDK程序
  19. C++ 获取本机所有的网卡配置、IP地址和Mac地址
  20. 漫长的岁月,沧海历经的人生

热门文章

  1. vue实现星级评价效果
  2. mysql left join join right
  3. LeetCode OJ - Candy
  4. 截获所有以太网帧数据并进行具体分析
  5. nlog轻量级日志组件
  6. 验证dropdownlist必选
  7. 关于各种JOIN连接的解释说明【原创】
  8. 使用pm2启动Node和Vue项目教程
  9. Vue — 第五天(路由)
  10. Spring Cloud(F版)搭建高可用服务注册中心