Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
za0612
pcl
提交
16bd23eb
P
pcl
项目概览
za0612
/
pcl
与 Fork 源项目一致
从无法访问的项目Fork
通知
13
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
pcl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
16bd23eb
编写于
2月 05, 2020
作者:
K
Kunal Tyagi
提交者:
GitHub
2月 05, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3614 from office-florian-hubner/vector_initialization_NormalEstimationOMP
Fix vector initialization in NormalEstimationOMP
上级
58e1b1eb
5e0d70c3
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
62 addition
and
2 deletion
+62
-2
features/include/pcl/features/impl/normal_3d_omp.hpp
features/include/pcl/features/impl/normal_3d_omp.hpp
+2
-2
test/features/test_normal_estimation.cpp
test/features/test_normal_estimation.cpp
+60
-0
未找到文件。
features/include/pcl/features/impl/normal_3d_omp.hpp
浏览文件 @
16bd23eb
...
@@ -71,7 +71,7 @@ pcl::NormalEstimationOMP<PointInT, PointOutT>::computeFeature (PointCloudOut &ou
...
@@ -71,7 +71,7 @@ pcl::NormalEstimationOMP<PointInT, PointOutT>::computeFeature (PointCloudOut &ou
if
(
input_
->
is_dense
)
if
(
input_
->
is_dense
)
{
{
#ifdef _OPENMP
#ifdef _OPENMP
#pragma omp parallel for shared (output) private (nn_indices, nn_dists) num_threads(threads_)
#pragma omp parallel for shared (output)
first
private (nn_indices, nn_dists) num_threads(threads_)
#endif
#endif
// Iterating over the entire index vector
// Iterating over the entire index vector
for
(
std
::
ptrdiff_t
idx
=
0
;
idx
<
static_cast
<
std
::
ptrdiff_t
>
(
indices_
->
size
());
++
idx
)
for
(
std
::
ptrdiff_t
idx
=
0
;
idx
<
static_cast
<
std
::
ptrdiff_t
>
(
indices_
->
size
());
++
idx
)
...
@@ -98,7 +98,7 @@ pcl::NormalEstimationOMP<PointInT, PointOutT>::computeFeature (PointCloudOut &ou
...
@@ -98,7 +98,7 @@ pcl::NormalEstimationOMP<PointInT, PointOutT>::computeFeature (PointCloudOut &ou
else
else
{
{
#ifdef _OPENMP
#ifdef _OPENMP
#pragma omp parallel for shared (output) private (nn_indices, nn_dists) num_threads(threads_)
#pragma omp parallel for shared (output)
first
private (nn_indices, nn_dists) num_threads(threads_)
#endif
#endif
// Iterating over the entire index vector
// Iterating over the entire index vector
for
(
std
::
ptrdiff_t
idx
=
0
;
idx
<
static_cast
<
std
::
ptrdiff_t
>
(
indices_
->
size
());
++
idx
)
for
(
std
::
ptrdiff_t
idx
=
0
;
idx
<
static_cast
<
std
::
ptrdiff_t
>
(
indices_
->
size
());
++
idx
)
...
...
test/features/test_normal_estimation.cpp
浏览文件 @
16bd23eb
...
@@ -182,6 +182,66 @@ TEST (PCL, NormalEstimation)
...
@@ -182,6 +182,66 @@ TEST (PCL, NormalEstimation)
EXPECT_EQ
(
normals
->
points
.
size
(),
indices
.
size
());
EXPECT_EQ
(
normals
->
points
.
size
(),
indices
.
size
());
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// There was an issue where the vectors for the indices and the
// distances of the neighbor search weren't initialized correctly
// due to a wrong usage of OpenMP.
// See PR #3614 for details.
// This tests if the vectors are initialized correctly.
template
<
typename
PointT
>
class
DummySearch
:
public
pcl
::
search
::
Search
<
PointT
>
{
public:
virtual
int
nearestKSearch
(
const
PointT
&
point
,
int
k
,
std
::
vector
<
int
>
&
k_indices
,
std
::
vector
<
float
>
&
k_sqr_distances
)
const
{
(
void
)
point
;
EXPECT_GE
(
k_indices
.
size
(),
k
);
EXPECT_GE
(
k_sqr_distances
.
size
(),
k
);
return
k
;
}
virtual
int
radiusSearch
(
const
PointT
&
point
,
double
radius
,
std
::
vector
<
int
>&
k_indices
,
std
::
vector
<
float
>&
k_sqr_distances
,
unsigned
int
max_nn
=
0
)
const
{
(
void
)
point
;
(
void
)
radius
;
(
void
)
k_indices
;
(
void
)
k_sqr_distances
;
return
max_nn
;
}
};
TEST
(
PCL
,
NormalEstimationOpenMPInitVectors
)
{
NormalEstimationOMP
<
PointXYZ
,
Normal
>
n
(
4
);
// instantiate 4 threads
DummySearch
<
PointXYZ
>::
Ptr
dummy
(
new
DummySearch
<
PointXYZ
>
);
// Object
PointCloud
<
Normal
>::
Ptr
normals
(
new
PointCloud
<
Normal
>
());
// set parameters
PointCloud
<
PointXYZ
>::
Ptr
cloudptr
=
cloud
.
makeShared
();
n
.
setInputCloud
(
cloudptr
);
EXPECT_EQ
(
n
.
getInputCloud
(),
cloudptr
);
pcl
::
IndicesPtr
indicesptr
(
new
pcl
::
Indices
(
indices
));
n
.
setIndices
(
indicesptr
);
EXPECT_EQ
(
n
.
getIndices
(),
indicesptr
);
n
.
setSearchMethod
(
dummy
);
EXPECT_EQ
(
n
.
getSearchMethod
(),
dummy
);
n
.
setKSearch
(
static_cast
<
int
>
(
indices
.
size
()));
// This will cause a call to DummySearch::nearestKSearch
// which checks if the vectors for the indices and the
// distances are correctly set up. See PR #3614.
n
.
compute
(
*
normals
);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TEST
(
PCL
,
NormalEstimationOpenMP
)
TEST
(
PCL
,
NormalEstimationOpenMP
)
{
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录