Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
txt2pcd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thibault Payet
txt2pcd
Commits
7bf29d5a
Verified
Commit
7bf29d5a
authored
4 years ago
by
Thibault Payet
Browse files
Options
Downloads
Patches
Plain Diff
add txt2pcd code
parent
d3b29b89
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.cpp
+56
-1
56 additions, 1 deletion
main.cpp
meson.build
+3
-1
3 additions, 1 deletion
meson.build
with
59 additions
and
2 deletions
main.cpp
+
56
−
1
View file @
7bf29d5a
int
main
(
int
argc
,
char
**
argv
)
#include
<filesystem>
#include
<fstream>
#include
<iostream>
#include
<pcl/io/pcd_io.h>
void
txt2pcd
(
std
::
filesystem
::
path
input
,
std
::
filesystem
::
path
output
)
{
std
::
ifstream
inputFile
{
input
.
c_str
()};
if
(
inputFile
)
{
pcl
::
PointCloud
<
pcl
::
PointXYZRGB
>
cloud
;
while
(
!
inputFile
.
eof
()
)
{
pcl
::
PointXYZRGB
point
;
inputFile
>>
point
.
x
;
inputFile
>>
point
.
y
;
inputFile
>>
point
.
z
;
inputFile
>>
point
.
r
;
inputFile
>>
point
.
g
;
inputFile
>>
point
.
b
;
cloud
.
push_back
(
point
);
}
pcl
::
PCDWriter
pcdWriter
{};
pcdWriter
.
writeBinaryCompressed
(
output
.
string
(),
cloud
);
}
}
void
printHelp
()
{
std
::
cout
<<
"Usage: txt2pcd inputCloud.txt outputCloud.pcd
\n
"
;
}
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
==
3
)
{
try
{
txt2pcd
(
argv
[
1
],
argv
[
2
]
);
}
catch
(
std
::
exception
const
&
e
)
{
std
::
cerr
<<
e
.
what
()
<<
"
\n
"
;
}
}
else
{
printHelp
();
}
return
0
;
}
This diff is collapsed.
Click to expand it.
meson.build
+
3
−
1
View file @
7bf29d5a
...
...
@@ -5,6 +5,8 @@ pcl_version = get_option('pcl_version')
pcl_io_dep
=
dependency
(
'pcl_io-@0@'
.
format
(
pcl_version
),
required
:
true
)
boost_dep
=
dependency
(
'boost'
)
executable
(
'txt2pcd'
,
sources
:
files
([
'main.cpp'
]),
dependencies
:
[
pcl_io_dep
])
dependencies
:
[
pcl_io_dep
,
boost_dep
])
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment