使用自制离线数据跑通ElasticFusion

使用自制离线数据跑通ElasticFusion

实验环境及设备

实验环境:

  • Ubuntu22.04
  • RTX3060

实验设备:

  • 小米13(Android)
  • Realsense D455

一句话总结就是,使用我的手机连接realsense去室外录制相关离线数据(.bag格式),然后转换成ElasticiFusion的.klg格式进行三维重建。

138_1678672876_hd

过程中还是遇到了不少坑的,比如深度图的尺度以及编码问题,导致一开始的重建总是不顺利。

代码

相关的代码我放在了这个仓库里:https://github.com/CuriosityWang/bag2klg

目录组织:

image-20230313112427061

Env

编译png_to_klg

这里的代码主要参考了https://github.com/HTLife/png_to_klg

  • CMake
  • Boost
  • zlib
  • libjpeg
  • OpenCV

在编译之前要修改 main.cpp 下第45行的 depth_scale 为1000,realsense默认是1000

image-20230313114213147

build

cd png_to_klg
mkdir build
cd build
cmake ..
make
ros相关库

建议使用虚拟环境

numpy

pip install numpy

rosbag

pip install --extra-index-url https://rospypi.github.io/simple/ rosbag
pip install roslz4 --extra-index-url https://rospypi.github.io/simple/

cv_bridge

  1. 下载源码https://codeload.github.com/ros-perception/vision_opencv/zip/refs/heads/noetic

  2. cd至cv_bridge文件夹

  3. 然后命令行安装

    python setup.py install

sensor_image and geometry_msgs

pip install sensor_msgs --extra-index-url https://rospypi.github.io/simple/
pip install geometry_msgs --extra-index-url https://rospypi.github.io/simple/

rospy

pip install -i https://pypi.douban.com/simple rospy

cv_bridge.boost

在这里下载 https://github.com/rospypi/simple/raw/any/cv-bridge/cv_bridge-1.13.0.post0-py2.py3-none-any.whl

pip install cv_bridge-1.13.0.post0-py2.py3-none-any.whl

Usage

  1. run read_bag.py
python read_bad.py -n YourBagFile -d YourDepthTopic -r YourRGBTopic
  1. 根据提示修改 png2klg.sh相关参数
cd png_to_klg
# set  the path for the depth.txt and rgb.txt.  ** feed the depth file first and then rgb file **
python associate.py ../bag_data/600/depth.txt ../bag_data/600/rgb.txt > associations.txt 
# to copy the associations.txt to your your_bag_data's path
cp associations.txt ../bag_data/600/associations.txt

cd build
# -w is the extracted rgb and depth images's path -o is the output
./pngtoklg -w ../../bag_data/600 -o ../../bag_data/600/600.klg -t
  1. run png2klg.sh
sh png2klg.sh

最后的目录应该是这样:

image-20230313162714627
  1. 在编译好的ElasticFusion下运行
./ElasticFusion -l 600.klg

Refer

https://github.com/HTLife/png_to_klg

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

王行知

您的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值