当前位置:网站首页>orbslam2实验记录-----稠密建图
orbslam2实验记录-----稠密建图
2022-08-08 17:31:00 【Alaso_soso】
实验环境:
操作系统:ubuntu 18.04
源码下载:
git clone https://github.com/gaoxiang12/ORBSLAM2_with_pointcloud_map.git
下载源码后,由于BOW太大,没有在github中,需要做一些准备:
- 将原ORB_SLAM2中的Vocabulary文件夹包括里面的内容拷贝到ORB_SLAM2_modified文件夹下
- 删除如下路径中的build文件夹:
ORB_SLAM2_modified/
ORB_SLAM2_modified/Thirdparty/DBoW2
ORB_SLAM2_modified/Thirdparty/g2o
代码修改:
彩色稠密建图:
- ①修改include/Tracking.h
Frame mCurrentFrame;
cv::Mat mImRGB; //new add
cv::Mat mImGray;
- ②修改src/Tracking.cc定义RGB矩阵
cv::Mat Tracking::GrabImageRGBD(const cv::Mat &imRGB,const cv::Mat &imD, const double ×tamp)
{
mImRGB = imRGB; // new add
mImGray = imRGB;
......
mpPointCloudMapping->insertKeyFrame( pKF, this->mImGray, this->mImDepth );
//change the mImGray to mImRGB as next row
mpPointCloudMapping->insertKeyFrame( pKF, this->mImRGB, this->mImDepth );// new
- ③修改src/pointcloudmapping.cc
#include <pcl/io/pcd_io.h>
在void PointCloudMapping::viewer()函数中加入保存地图的指令:
while(1)
{
.... // 省略
for ( size_t i=lastKeyframeSize; i<N ; i++ )
{
PointCloud::Ptr p = generatePointCloud( keyframes[i], colorImgs[i], depthImgs[i] );
*globalMap += *p;
}
PointCloud::Ptr tmp(new PointCloud());
voxel.setInputCloud( globalMap );
voxel.filter( *tmp );
globalMap->swap( *tmp );
viewer.showCloud( globalMap );
cout << "show global map, size=" << globalMap->points.size() << endl;
lastKeyframeSize = N;
}
pcl::io::savePCDFileBinary("vslam.pcd", *globalMap); //new add 加在while循环外面
- 修改yaml配置文件,yaml1已经存在,但是yaml2和yaml3没有,不添加,便不会建图
PointCloudMapping.Resolution: 0.01
meank: 50
thresh: 2.0
编译工程
cd ORB_SLAM2_modified
./build.sh
测试运行
和orbslam2一样,同样需要关联文件,将时间戳对齐。
cd ORB_SLAM2_modified
./bin/rgbd_tum ./Vocabulary/ORBvoc.bin Examples/RGB-D/TUM3.yaml ~/Desktop/dataset/TUM/rgbd_dataset_freiburg3_walking_xyz ~/Desktop/dataset/TUM/rgbd_dataset_freiburg3_walking_xyz/associate.txt
代码中将词袋模型转换为二进制.bin文件读入,我的内存为4g,不转换会出现:已杀死的情况,原因是内存爆了,因此要换行为二进制文件读入。
查看生成的.pcd文件
sudo apt get install pcl tools
pcl_viewer vslam.pcd
问题:三色格子
建图中,会出现红绿黑三色,不要着急,将鼠标移入,滚动滑轮,缩小,就可以看到建图的结果。
参考:
从零开始Ubuntu16.04+ORBSLAM2+ROS实验实录(五):稠密点云建图_Mr.Winter`的博客-CSDN博客_orbslam稠密建图
边栏推荐
猜你喜欢
The latest research from PNAS: 81% problem solving rate, neural network Codex opens the door to the world of advanced mathematics
arxiv国内镜像——快速下载
Tensorflow教程(四)——MNIST项目入门
比较器是否可以当做运放使用?
用皮肤“听”音乐,网友戴上这款装备听音乐会:仿佛住在钢琴里
How to set timed network disconnection to assist self-discipline in win10
spark学习笔记(八)——sparkSQL概述-定义/特点/DataFrame/DataSet
Cuda Anaconda tensorflow 版本对应
Tess4J OCR简单使用教程
【NodeJs篇】fs文件系统模块
随机推荐
D. Non-zero Segments
B+树与B-树的区别
D2. Sage‘s Birthday (hard version)
LeetCode(剑指 Offer)- 21. 调整数组顺序使奇数位于偶数前面
Tensorflow教程(三)——获取数据 feed 和 fetchn
L2-017 人以群分 (25 分)
【20210923】选择感兴趣的研究方向?
2 prerequisites for the success of "digital transformation" of enterprises!
C语言中变量在内存中的保存与访问
1.初识MySQL数据库
L2-012 关于堆的判断 (25 分)(堆)
通俗易懂的epoll
数据库分析与优化
How to set timed network disconnection to assist self-discipline in win10
Qt——选择文件夹并获取路径以及文件夹下子文件
LeetCode_二叉树_中等_515.在每个树行中找最大值
【20210923】Choose the research direction you are interested in?
List<String>用空串替换null值,并且都加上单引号,并且转为字符串用,分割
pytorch常用语句
L2-021 点赞狂魔 (25 分)