Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
fmt_converter
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xuebingbing
fmt_converter
Commits
a667db63
Commit
a667db63
authored
Apr 27, 2021
by
xuebingbing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 新增指定pcd 导出fields的功能(兼容旧数据格式);
2 优化命令行使用信息
parent
d9354fc5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
4 deletions
+24
-4
convertor.cpp
src/jfhdconvert/convertor.cpp
+10
-4
convertor.h
src/jfhdconvert/convertor.h
+14
-0
main.cpp
src/jfhdconvertor/main.cpp
+0
-0
No files found.
src/jfhdconvert/convertor.cpp
View file @
a667db63
...
@@ -62,18 +62,22 @@ pdal::Dimension::Type GetLasDimDataType(const pcl::PCLPointField& field)
...
@@ -62,18 +62,22 @@ pdal::Dimension::Type GetLasDimDataType(const pcl::PCLPointField& field)
}
}
}
}
std
::
unordered_map
<
std
::
string
,
pdal
::
Dimension
::
Id
>
GetLasdimidFromPcdFields
(
const
std
::
vector
<::
pcl
::
PCLPointField
>&
pcdfields
,
pdal
::
PointLayoutPtr
layerout
)
std
::
unordered_map
<
std
::
string
,
pdal
::
Dimension
::
Id
>
GetLasdimidFromPcdFields
(
const
std
::
vector
<::
pcl
::
PCLPointField
>&
pcdfields
,
const
jfhd
::
convert
::
Pcd2LasInfo
&
info
,
pdal
::
PointLayoutPtr
layerout
)
{
{
std
::
unordered_map
<
std
::
string
,
pdal
::
Dimension
::
Id
>
dict
;
std
::
unordered_map
<
std
::
string
,
pdal
::
Dimension
::
Id
>
dict
;
for
(
auto
field
:
pcdfields
)
for
(
auto
&
field
:
pcdfields
)
{
{
if
(
0
==
field
.
name
.
compare
(
"_"
))
if
(
0
==
info
.
fieldnames
.
count
(
field
.
name
))
{
std
::
cout
<<
"skip:"
<<
field
.
name
<<
std
::
endl
;
continue
;
continue
;
}
auto
dimdatatype
=
GetLasDimDataType
(
field
);
auto
dimdatatype
=
GetLasDimDataType
(
field
);
if
(
pdal
::
Dimension
::
Type
::
None
==
dimdatatype
)
if
(
pdal
::
Dimension
::
Type
::
None
==
dimdatatype
)
{
{
// TODO::
// TODO::
std
::
cout
<<
"skip:"
<<
field
.
name
<<
std
::
endl
;
continue
;
continue
;
}
}
...
@@ -87,6 +91,8 @@ std::unordered_map<std::string, pdal::Dimension::Id> GetLasdimidFromPcdFields(co
...
@@ -87,6 +91,8 @@ std::unordered_map<std::string, pdal::Dimension::Id> GetLasdimidFromPcdFields(co
dim
=
layerout
->
assignDim
(
field
.
name
,
dimdatatype
);
dim
=
layerout
->
assignDim
(
field
.
name
,
dimdatatype
);
}
}
std
::
cout
<<
"export: "
<<
field
.
name
<<
"->"
<<
layerout
->
dimName
(
dim
)
<<
std
::
endl
;
dict
.
emplace
(
std
::
make_pair
(
field
.
name
,
dim
));
dict
.
emplace
(
std
::
make_pair
(
field
.
name
,
dim
));
}
}
...
@@ -210,7 +216,7 @@ namespace jfhd {
...
@@ -210,7 +216,7 @@ namespace jfhd {
pdal
::
PointTable
table
;
pdal
::
PointTable
table
;
auto
layerout
=
table
.
layout
();
auto
layerout
=
table
.
layout
();
std
::
unordered_map
<
std
::
string
,
pdal
::
Dimension
::
Id
>
std
::
unordered_map
<
std
::
string
,
pdal
::
Dimension
::
Id
>
dict_pclfieldname_lasid
=
GetLasdimidFromPcdFields
(
pcloud
.
fields
,
table
.
layout
());
dict_pclfieldname_lasid
=
GetLasdimidFromPcdFields
(
pcloud
.
fields
,
info
,
table
.
layout
());
pdal
::
PointViewPtr
view
(
new
pdal
::
PointView
(
table
));
pdal
::
PointViewPtr
view
(
new
pdal
::
PointView
(
table
));
std
::
uint64_t
width
=
pcloud
.
width
;
std
::
uint64_t
width
=
pcloud
.
width
;
...
...
src/jfhdconvert/convertor.h
View file @
a667db63
#ifndef JF_HD_CONVERT_SWITH_H_
#ifndef JF_HD_CONVERT_SWITH_H_
#define JF_HD_CONVERT_SWITH_H_
#define JF_HD_CONVERT_SWITH_H_
#include <string>
#include <string>
#include <set>
#include "export.h"
#include "export.h"
namespace
jfhd
{
namespace
jfhd
{
...
@@ -8,9 +9,13 @@ namespace jfhd {
...
@@ -8,9 +9,13 @@ namespace jfhd {
struct
CONVERT_API
Pcd2LasInfo
struct
CONVERT_API
Pcd2LasInfo
{
{
// pcd x(y,z) + (offset x(y,z) = las x(y,z)
double
offsetx
=
0
.
0
;
double
offsetx
=
0
.
0
;
double
offsety
=
0
.
0
;
double
offsety
=
0
.
0
;
double
offsetz
=
0
.
0
;
double
offsetz
=
0
.
0
;
// pcd 存在的fieldname 转换到las中, 为空时全部转换,不用指定x,y,z 字段, 区分大小写
std
::
set
<
std
::
string
>
fieldnames
=
{};
};
};
class
CONVERT_API
Convertor
class
CONVERT_API
Convertor
...
@@ -19,6 +24,15 @@ namespace jfhd {
...
@@ -19,6 +24,15 @@ namespace jfhd {
Convertor
();
Convertor
();
~
Convertor
();
~
Convertor
();
/**
* @brief pcd 转 las文件
* @param pcdfilepath 输入文件
* @param lasfilepath 输出文件
* @param info x,y,z
* @param fieldnames
* @param errormsg
* @return
*/
static
bool
Pcd2Las
(
const
std
::
string
&
pcdfilepath
,
const
std
::
string
&
lasfilepath
,
const
Pcd2LasInfo
&
info
,
std
::
string
*
errormsg
);
static
bool
Pcd2Las
(
const
std
::
string
&
pcdfilepath
,
const
std
::
string
&
lasfilepath
,
const
Pcd2LasInfo
&
info
,
std
::
string
*
errormsg
);
};
};
}
}
...
...
src/jfhdconvertor/main.cpp
View file @
a667db63
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment