Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
00cce4ac
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
00cce4ac
编写于
9月 25, 2018
作者:
L
Liangliang Zhang
提交者:
Jiangtao Hu
9月 25, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Perception: added lidar_object_util.
上级
479fa5d2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
40 addition
and
15 deletion
+40
-15
modules/perception/lidar/common/.gitignore
modules/perception/lidar/common/.gitignore
+0
-1
modules/perception/lidar/common/BUILD
modules/perception/lidar/common/BUILD
+14
-0
modules/perception/lidar/common/lidar_object_util.cc
modules/perception/lidar/common/lidar_object_util.cc
+20
-11
modules/perception/lidar/common/lidar_object_util.h
modules/perception/lidar/common/lidar_object_util.h
+6
-3
未找到文件。
modules/perception/lidar/common/.gitignore
已删除
100644 → 0
浏览文件 @
479fa5d2
lidar_options_define.h
modules/perception/lidar/common/BUILD
浏览文件 @
00cce4ac
...
...
@@ -63,4 +63,18 @@ cc_library(
],
)
cc_library
(
name
=
"lidar_object_util"
,
srcs
=
[
"lidar_object_util.cc"
,
],
hdrs
=
[
"lidar_object_util.h"
,
],
deps
=
[
"//modules/perception/base"
,
":lidar_log"
,
],
)
cpplint
()
modules/perception/lidar/common/lidar_object_util.cc
浏览文件 @
00cce4ac
...
...
@@ -14,14 +14,23 @@
* limitations under the License.
*****************************************************************************/
#include "modules/perception/lidar/common/lidar_object_util.h"
#include <algorithm>
#include "modules/perception/base/point_cloud_types.h"
#include "modules/perception/lidar/common/lidar_log.h"
namespace
apollo
{
namespace
perception
{
namespace
lidar
{
void
GetBoundingBox2d
(
const
base
::
ObjectPtr
object
,
base
::
PolygonDType
*
box
,
double
expand
)
{
using
base
::
Object
;
using
base
::
PointF
;
using
base
::
PointD
;
using
base
::
PointCloud
;
void
GetBoundingBox2d
(
const
std
::
shared_ptr
<
Object
>
object
,
PointCloud
<
PointD
>*
box
,
double
expand
)
{
box
->
clear
();
box
->
resize
(
4
);
...
...
@@ -48,15 +57,15 @@ void GetBoundingBox2d(const base::ObjectPtr object, base::PolygonDType* box,
object
->
center
(
1
);
}
void
ComputeObjectShapeFromPolygon
(
base
::
ObjectPtr
object
,
void
ComputeObjectShapeFromPolygon
(
std
::
shared_ptr
<
Object
>
object
,
bool
use_world_cloud
)
{
const
base
::
PolygonDType
&
polygon
=
object
->
polygon
;
const
base
::
PointFCloud
&
cloud
=
object
->
lidar_supplement
.
cloud
;
const
base
::
PointDCloud
&
world_cloud
=
object
->
lidar_supplement
.
cloud_world
;
const
PointCloud
<
PointD
>
&
polygon
=
object
->
polygon
;
const
PointCloud
<
PointF
>
&
cloud
=
object
->
lidar_supplement
.
cloud
;
const
PointCloud
<
PointD
>
&
world_cloud
=
object
->
lidar_supplement
.
cloud_world
;
if
(
polygon
.
size
()
==
0
||
cloud
.
size
()
==
0
)
{
LOG_
INFO
<<
"Failed to compute box, polygon size: "
<<
polygon
.
size
()
<<
" cloud size: "
<<
cloud
.
size
();
A
INFO
<<
"Failed to compute box, polygon size: "
<<
polygon
.
size
()
<<
" cloud size: "
<<
cloud
.
size
();
return
;
}
...
...
@@ -73,7 +82,7 @@ void ComputeObjectShapeFromPolygon(base::ObjectPtr object,
// note we keep this offset to avoid numeric precision issues in world frame
Eigen
::
Vector2d
offset
(
object
->
polygon
[
0
].
x
,
object
->
polygon
[
0
].
y
);
for
(
const
auto
&
point
:
object
->
polygon
)
{
for
(
const
auto
&
point
:
object
->
polygon
.
points
()
)
{
polygon_xy
<<
point
.
x
,
point
.
y
;
polygon_xy
-=
offset
;
projected_polygon_xy
(
0
)
=
direction
.
dot
(
polygon_xy
);
...
...
@@ -89,14 +98,14 @@ void ComputeObjectShapeFromPolygon(base::ObjectPtr object,
if
(
use_world_cloud
)
{
min_z
=
world_cloud
[
0
].
z
;
max_z
=
world_cloud
[
0
].
z
;
for
(
const
auto
&
point
:
world_cloud
)
{
for
(
const
auto
&
point
:
world_cloud
.
points
()
)
{
min_z
=
std
::
min
(
min_z
,
point
.
z
);
max_z
=
std
::
max
(
max_z
,
point
.
z
);
}
}
else
{
min_z
=
cloud
[
0
].
z
;
max_z
=
cloud
[
0
].
z
;
for
(
const
auto
&
point
:
cloud
)
{
for
(
const
auto
&
point
:
cloud
.
points
()
)
{
min_z
=
std
::
min
(
min_z
,
static_cast
<
double
>
(
point
.
z
));
max_z
=
std
::
max
(
max_z
,
static_cast
<
double
>
(
point
.
z
));
}
...
...
modules/perception/lidar/common/lidar_object_util.h
浏览文件 @
00cce4ac
...
...
@@ -15,8 +15,11 @@
*****************************************************************************/
#ifndef MODULES_PERCEPTION_LIDAR_COMMON_LIDAR_OBJECT_UTIL_H_
#define MODULES_PERCEPTION_LIDAR_COMMON_LIDAR_OBJECT_UTIL_H_
#include "modules/perception/base/object.h"
#include <memory>
namespace
apollo
{
namespace
perception
{
namespace
lidar
{
...
...
@@ -25,13 +28,13 @@ namespace lidar {
// @param [in]: object
// @param [in]: expand valud, in meter
// @param [out]: bounding box vertices(4 in xy plane)
void
GetBoundingBox2d
(
const
base
::
ObjectPtr
object
,
base
::
PolygonDType
*
box
,
double
expand
=
0.0
);
void
GetBoundingBox2d
(
const
std
::
shared_ptr
<
base
::
Object
>
object
,
base
::
PointCloud
<
base
::
PointD
>*
box
,
double
expand
=
0.0
);
// @brief: compute object shape(center, size) from given direction and polygon
// @param [in/out]: input object, center and size will be updated
// @param [in]: whether use world cloud or local cloud
void
ComputeObjectShapeFromPolygon
(
base
::
ObjectPtr
object
,
void
ComputeObjectShapeFromPolygon
(
std
::
shared_ptr
<
base
::
Object
>
object
,
bool
use_world_cloud
=
false
);
}
// namespace lidar
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录