当前位置:网站首页>Use PCL to batch convert point cloud.Bin files to.Pcd
Use PCL to batch convert point cloud.Bin files to.Pcd
2022-07-28 22:38:00 【Everything】

B standing | official account : A graduate student who knows everything
- New folder datasets
- datasets Two folders will be created under the file
binAndpcd,binStore binary files to be converted in ,pcdStore the converted point cloud file - datasets Under the new CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
project(bin2pcd)
find_package(PCL 1.2 REQUIRED)
find_package(Boost COMPONENTS program_options REQUIRED )
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable(bin2pcd bin2pcd.cpp)
target_link_libraries (bin2pcd ${PCL_LIBRARIES} ${Boost_LIBRARIES})
install(TARGETS bin2pcd RUNTIME DESTINATION bin)
- newly build bin2pcd.cpp
#include <boost/program_options.hpp>
#include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>
#include <pcl/common/io.h>
#include <pcl/io/vtk_io.h>
#include <vector>
#include <iostream>
#include <fstream>
using namespace pcl;
using namespace std;
void topcd(string name);
void topcd(string infile,string outfile) {
// load point cloud
fstream input(infile.c_str(), ios::in | ios::binary);
if (!input.good()) {
cerr << "Could not read file: " << infile << endl;
exit(EXIT_FAILURE);
}
input.seekg(0, ios::beg);
pcl::PointCloud<PointXYZI>::Ptr points(new pcl::PointCloud<PointXYZI>);
int i;
for (i = 0; input.good() && !input.eof(); i++) {
PointXYZI point;
input.read((char*)&point.x, 3 * sizeof(float));
input.read((char*)&point.intensity, sizeof(float));
points->push_back(point);
}
input.close();
cout << "Read point cloud with " << i << " points, writing to " << outfile << endl;
pcl::PCDWriter writer;
// Save DoN features
writer.write<PointXYZI>(outfile, *points, false);
}
int main(int argc, char** argv) {
string binpath = "/home/xxxx/datasets/bin/";
string pcdpath = "/home/xxxx/datasets/pcd/";
vector<boost::filesystem::path> stream(boost::filesystem::directory_iterator{
binpath}, boost::filesystem::directory_iterator{
});
sort(stream.begin(), stream.end());
auto streamIterator = stream.begin();
int j = 0;
while(streamIterator != stream.end()){
string binfile((*streamIterator).string());
stringstream ss;
string str;
ss << setw(10) << setfill('0') << j; // Zero compensation
ss >> str;
string surfix = ".pcd";
string pcdfile = pcdpath + str + surfix;
topcd(binfile,pcdfile);
streamIterator++;
j++;
}
return 0;
}
- Note that only modification is required
binpathAndpcdpathFor your path - newly build build Folder , So now the file level is like this
├── bin2pcd.cpp
├── build
├── CMakeLists.txt
└── datasets
├── bin
├── 0000000000.bin
├── 0000000001.bin
...
└── pcd
├── 0000000000.bin
├── 0000000001.bin
...
- The remaining steps are normal compilation ,
Get into build Folder
cmake .. && make -j12
- Then run the file
./bin2pcd
边栏推荐
- Paddlenlp is based on ernir3.0 text classification. Take the traditional Chinese medicine search and retrieval semantic map classification (kuake-qic) as an example [multi classification (single label
- Analysis notes on let (const) temporary dead zone in JS
- 20-09-27项目迁移到阿里折腾记录(网卡顺序导致服务无法通过haproxy连接到db)
- Research cup element recognition multi label classification task based on ernie-3.0 cail2019 method
- 使用PCL批量将点云.bin文件转.pcd
- elment-plus图标input上面带的图标为什么不显示
- Log4j vulnerability elk platform processing method (logstah5.5.1)
- Common commands of NPM
- Quadruped robot | gem (elevation map) + fast_ Deployment records of Leo (odometry) environment
- fatal error: io. h: No such file or directory
猜你喜欢

Day3 classification management of Ruiji takeout project

PaddleNLP基于ERNIR3.0文本分类:WOS数据集为例(层次分类)

MySQL built-in functions

软考网络工程师
![[LiteratureReview]Object Detection and Mapping with Bounding Box Constraints](/img/37/7cb5fa3a9078a5f5947485147c819d.png)
[LiteratureReview]Object Detection and Mapping with Bounding Box Constraints

79. Word search (medium string array matrix backtracking)
![[virtual machine _2]-hyper-v and vmware/virtualbox cannot coexist](/img/90/c481a817dc91d7e5247dd8e3ee1dae.png)
[virtual machine _2]-hyper-v and vmware/virtualbox cannot coexist

When can I sign up for the 2022 class I constructor examination?

Sword finger offer II 055. Binary search tree iterator (medium binary search tree iterator)

php二维数组如何删除去除第一行元素
随机推荐
75. Color classification (medium array double pointer sorting)
Soft exam network engineer
Sword finger offer II 056. Sum of two nodes in a binary search tree (simple binary search tree DFS hash table double pointer iterator)
96. Different binary search trees (medium binary search tree dynamic planning)
MySQL installation and configuration (super detailed, simple and practical)
职场pua但有道理
Quadruped robot | gem (elevation map) + fast_ Deployment records of Leo (odometry) environment
Win11 how to open software notification
BOM (location object, navigation object)
Container configuration starts redis cluster single machine 6 nodes 3 Master 3 slave
How about the actual use effect of common source oscilloscope
[Ruiji takeout project] Day5 - Chapter 6 mobile verification code login
Sword finger offer II 066. sum of words (medium prefix tree design string)
【转载】token令牌在登录场景使用
2022年一级建造师考试什么时候才能报名?
Changes in the history of oscilloscope development
Use REM to make the font size adaptive to the screen
SQL injection less38 (Stack Injection)
Ultra detailed visual studio 2019 running littlevgl (lvgl) simulator
Mysql8.0 cannot authorize users or prompt you are not allowed to create a user with grant