1、时间命名的影像改为序列号命名的影像
最近在跑一个SLAM相关算法的时候遇到一个问题,被广泛测试的TUM数据集如何将以采集时间命名的图片保存为以序号命名的图片。
TUM原始数据:
assciations.txt、rgb文件、depth文件是原始数据
处理之后的TUM数据:
assciations1.txt、rgb1文件、depth1文件是处理之后的数据
#include<iostream>
#include<fstream>
#include <string>
#include<string>
#include <vector>
using namespace std;
void SplitString(const string& s, vector<string>& v, const string& c)
{
string::size_type pos1, pos2;
pos2 = s.find(c);
pos1 = 0;
while (string::npos != pos2)
{
v.push_back(s.substr(pos1, pos2 - pos1));
pos1 = pos2 + c.size();
pos2 = s.find(c, pos1);
}
if (pos1 != s.length())
v.push_back(s.substr(pos1));
}
void Rgb_Save(int Num, string Rgbdir)
{
//保存输入图像文件名和输出图像文件名
const char* InImgName;
const char* OutImgName;
//图像数据长度
int length