当前位置:网站首页>Record your own dataset with d435i, run orbslam2 and build a dense point cloud
Record your own dataset with d435i, run orbslam2 and build a dense point cloud
2022-04-23 04:33:00 【Tang Huanyi】
One 、 use sdk Recording rosbag
Two 、 Play rosbag And use rviz see topic, Write down the rgb and depth Stream title
3、 ... and 、 Use the following script (python2 instead of 3) preservation rgb and depth Pictures are generated at the same time rgb.txt、depth.txt
You can put alias python='/usr/bin/python2.7’ Write in bashrc, Remember to comment out .
Four 、 Use this script associate.py Generate associate.txt
import argparse
import sys
import os
import numpy
def read_file_list(filename):
""" Reads a trajectory from a text file. File format: The file format is "stamp d1 d2 d3 ...", where stamp denotes the time stamp (to be matched) and "d1 d2 d3.." is arbitary data (e.g., a 3D position and 3D orientation) associated to this timestamp. Input: filename -- File name Output: dict -- dictionary of (stamp,data) tuples """
file = open(filename)
data = file.read()
lines = data.replace(","," ").replace("\t"," ").split("\n")
list = [[v.strip() for v in line.split(" ") if v.strip()!=""] for line in lines if len(line)>0 and line[0]!="#"]
list = [(float(l[0]),l[1:]) for l in list if len(l)>1]
return dict(list)
def associate(first_list, second_list,offset,max_difference):
""" Associate two dictionaries of (stamp,data). As the time stamps never match exactly, we aim to find the closest match for every input tuple. Input: first_list -- first dictionary of (stamp,data) tuples second_list -- second dictionary of (stamp,data) tuples offset -- time offset between both dictionaries (e.g., to model the delay between the sensors) max_difference -- search radius for candidate generation Output: matches -- list of matched tuples ((stamp1,data1),(stamp2,data2)) """
first_keys = first_list.keys()
second_keys = second_list.keys()
potential_matches = [(abs(a - (b + offset)), a, b)
for a in first_keys
for b in second_keys
if abs(a - (b + offset)) < max_difference]
potential_matches.sort()
matches = []
for diff, a, b in potential_matches:
if a in first_keys and b in second_keys:
first_keys.remove(a)
second_keys.remove(b)
matches.append((a, b))
matches.sort()
return matches
if __name__ == '__main__':
# parse command line
parser = argparse.ArgumentParser(description=''' This script takes two data files with timestamps and associates them ''')
parser.add_argument('first_file', help='first text file (format: timestamp data)')
parser.add_argument('second_file', help='second text file (format: timestamp data)')
parser.add_argument('--first_only', help='only output associated lines from first file', action='store_true')
parser.add_argument('--offset', help='time offset added to the timestamps of the second file (default: 0.0)',default=0.0)
parser.add_argument('--max_difference', help='maximally allowed time difference for matching entries (default: 0.02)',default=0.02)
args = parser.parse_args()
first_list = read_file_list(args.first_file)
second_list = read_file_list(args.second_file)
matches = associate(first_list, second_list,float(args.offset),float(args.max_difference))
if args.first_only:
for a,b in matches:
print("%f %s"%(a," ".join(first_list[a])))
else:
for a,b in matches:
print("%f %s %f %s"%(a," ".join(first_list[a]),b-float(args.offset)," ".join(second_list[b])))
python2 associate.py depth.txt rgb.txt > associate.txt
5、 ... and 、 test
/Examples/RGB-D/rgbd_tum ./Vocabulary/ORBvoc.txt ./Examples/RGB-D/D435i.yaml ./dataset/ ./dataset/associate.txt
# A copy of D435i.yaml
%YAML:1.0
#--------------------------------------------------------------------------------------------
# Camera Parameters. Adjust them!
#--------------------------------------------------------------------------------------------
# Camera calibration and distortion parameters (OpenCV)
Camera.fx: 615.9417724609375
Camera.fy: 616.0935668945312
Camera.cx: 322.3533630371094
Camera.cy: 240.44674682617188
Camera.k1: 0.0
Camera.k2: 0.0
Camera.p1: 0.0
Camera.p2: 0.0
Camera.p3: 0.0
Camera.width: 640
Camera.height: 480
# Camera frames per second
Camera.fps: 30.0
# IR projector baseline times fx (aprox.)
# bf = baseline (in meters) * fx, D435i Of baseline = 50 mm
Camera.bf: 30.797
# Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale)
Camera.RGB: 1
# Close/Far threshold. Baseline times.
ThDepth: 40.0
# Deptmap values factor
DepthMapFactor: 1000.0
#--------------------------------------------------------------------------------------------
# ORB Parameters
#--------------------------------------------------------------------------------------------
# ORB Extractor: Number of features per image
ORBextractor.nFeatures: 1000
# ORB Extractor: Scale factor between levels in the scale pyramid
ORBextractor.scaleFactor: 1.2
# ORB Extractor: Number of levels in the scale pyramid
ORBextractor.nLevels: 8
# ORB Extractor: Fast threshold
# Image is divided in a grid. At each cell FAST are extracted imposing a minimum response.
# Firstly we impose iniThFAST. If no corners are detected we impose a lower value minThFAST
# You can lower these values if your images have low contrast
ORBextractor.iniThFAST: 20
ORBextractor.minThFAST: 7
#--------------------------------------------------------------------------------------------
# Viewer Parameters
#--------------------------------------------------------------------------------------------
Viewer.KeyFrameSize: 0.05
Viewer.KeyFrameLineWidth: 1
Viewer.GraphLineWidth: 0.9
Viewer.PointSize: 2
Viewer.CameraSize: 0.08
Viewer.CameraLineWidth: 3
Viewer.ViewpointX: 0
Viewer.ViewpointY: -0.7
Viewer.ViewpointZ: -1.8
Viewer.ViewpointF: 500
版权声明
本文为[Tang Huanyi]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230413573497.html
边栏推荐
- Installation of zynq platform cross compiler
- 229. 求众数 II
- 重剑无锋,大巧不工
- Opencv -- yoact case segmentation model reasoning
- 第四章 --- 了解标准设备文件、过滤器和管道
- [AI vision · quick review of today's sound acoustic papers, issue 2] Fri, 15 APR 2022
- Use recyclerview to realize left-right side-by-side classification selection
- [mapping program design] coordinate azimuth calculation artifact (version C)
- 【论文阅读】【3d目标检测】Improving 3D Object Detection with Channel-wise Transformer
- 【BIM入门实战】Revit中的墙体层次以及常见问题解答
猜你喜欢
Hard core chip removal
Coinbase:关于跨链桥的基础知识、事实和统计数据
QML进阶(五)-通过粒子模拟系统实现各种炫酷的特效
STM32单片机ADC规则组多通道转换-DMA模式
LabVIEW 小端序和大端序区别
Brushless motor drive scheme based on Infineon MCU GTM module
[AI vision · quick review of NLP natural language processing papers today, issue 31] Fri, 15 APR 2022
How to regulate intestinal flora? Introduction to common natural substances, probiotics and prebiotics
用D435i录制自己的数据集运行ORBslam2并构建稠密点云
第四章 --- 了解标准设备文件、过滤器和管道
随机推荐
C语言:恶搞小游戏
VSCode配置之Matlab极简配置
Leetcode->1 两数之和
阿里云IoT流转到postgresql数据库方案
基于英飞凌MCU GTM模块的无刷电机驱动方案开源啦
Single chip microcomputer serial port data processing (1) -- serial port interrupt sending data
[AI vision · quick review of robot papers today, issue 32] wed, 20 APR 2022
zynq平台交叉编译器的安装
QtSpim手册-中文翻译
【论文阅读】【3d目标检测】Improving 3D Object Detection with Channel-wise Transformer
The difference between lists, tuples, dictionaries and collections
QML进阶(五)-通过粒子模拟系统实现各种炫酷的特效
Coinbase:关于跨链桥的基础知识、事实和统计数据
Apache Bench(ab 压力测试工具)的安装与使用
C语言: 指针的进阶
QML进阶(四)-绘制自定义控件
【BIM入门实战】Revit建筑墙体:构造、包络、叠层图文详解
520.检测大写字母
阿里十年技术专家联合打造“最新”Jetpack Compose项目实战演练(附Demo)
Fusobacterium -- symbiotic bacteria, opportunistic bacteria, oncobacterium