Point Cloud Library (PCL)
1.15.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
features
impl
shot_lrf_omp.hpp
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2012, Willow Garage, Inc.
6
* Copyright (c) 2012-, Open Perception, Inc.
7
*
8
* All rights reserved.
9
*
10
* Redistribution and use in source and binary forms, with or without
11
* modification, are permitted provided that the following conditions
12
* are met:
13
*
14
* * Redistributions of source code must retain the above copyright
15
* notice, this list of conditions and the following disclaimer.
16
* * Redistributions in binary form must reproduce the above
17
* copyright notice, this list of conditions and the following
18
* disclaimer in the documentation and/or other materials provided
19
* with the distribution.
20
* * Neither the name of the copyright holder(s) nor the names of its
21
* contributors may be used to endorse or promote products derived
22
* from this software without specific prior written permission.
23
*
24
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
* POSSIBILITY OF SUCH DAMAGE.
36
*
37
* $Id$
38
*/
39
40
#ifndef PCL_FEATURES_IMPL_SHOT_LRF_OMP_H_
41
#define PCL_FEATURES_IMPL_SHOT_LRF_OMP_H_
42
43
#include <pcl/features/shot_lrf_omp.h>
44
#include <pcl/features/shot_lrf.h>
45
46
//////////////////////////////////////////////////////////////////////////////////////////////
47
template
<
typename
Po
int
InT,
typename
Po
int
OutT>
void
48
pcl::SHOTLocalReferenceFrameEstimationOMP<PointInT, PointOutT>::setNumberOfThreads
(
unsigned
int
nr_threads)
49
{
50
if
(nr_threads == 0)
51
#ifdef _OPENMP
52
threads_
= omp_get_num_procs();
53
#else
54
threads_
= 1;
55
#endif
56
else
57
threads_
= nr_threads;
58
}
59
60
//////////////////////////////////////////////////////////////////////////////////////////////
61
template
<
typename
Po
int
InT,
typename
Po
int
OutT>
void
62
pcl::SHOTLocalReferenceFrameEstimationOMP<PointInT, PointOutT>::computeFeature
(
PointCloudOut
&output)
63
{
64
//check whether used with search radius or search k-neighbors
65
if
(this->
getKSearch
() != 0)
66
{
67
PCL_ERROR(
68
"[pcl::%s::computeFeature] Error! Search method set to k-neighborhood. Call setKSearch(0) and setRadiusSearch( radius ) to use this class.\n"
,
69
getClassName
().c_str ());
70
return
;
71
}
72
tree_
->setSortedResults (
true
);
73
74
#pragma omp parallel for \
75
default(none) \
76
shared(output) \
77
num_threads(threads_) \
78
schedule(dynamic, 64)
79
for
(std::ptrdiff_t i = 0; i < static_cast<std::ptrdiff_t> (
indices_
->size ()); ++i)
80
{
81
// point result
82
Eigen::Matrix3f rf;
83
PointOutT& output_rf = output[i];
84
85
//output_rf.confidence = getLocalRF ((*indices_)[i], rf);
86
//if (output_rf.confidence == std::numeric_limits<float>::max ())
87
88
if
(
getLocalRF
((*
indices_
)[i], rf) == std::numeric_limits<float>::max ())
89
{
90
output.is_dense =
false
;
91
}
92
93
for
(
int
d = 0; d < 3; ++d)
94
{
95
output_rf.x_axis[d] = rf.row (0)[d];
96
output_rf.y_axis[d] = rf.row (1)[d];
97
output_rf.z_axis[d] = rf.row (2)[d];
98
}
99
}
100
101
}
102
103
#define PCL_INSTANTIATE_SHOTLocalReferenceFrameEstimationOMP(T,OutT) template class PCL_EXPORTS pcl::SHOTLocalReferenceFrameEstimationOMP<T,OutT>;
104
105
#endif
// PCL_FEATURES_IMPL_SHOT_LRF_H_
pcl::Feature< PointInT, ReferenceFrame >::getClassName
const std::string & getClassName() const
Definition
feature.h:244
pcl::Feature< PointInT, ReferenceFrame >::tree_
KdTreePtr tree_
Definition
feature.h:231
pcl::Feature< PointInT, ReferenceFrame >::getKSearch
int getKSearch() const
Definition
feature.h:188
pcl::PCLBase< PointInT >::indices_
IndicesPtr indices_
Definition
pcl_base.h:150
pcl::SHOTLocalReferenceFrameEstimation< PointInT, ReferenceFrame >::getLocalRF
float getLocalRF(const int &index, Eigen::Matrix3f &rf)
Definition
shot_lrf.hpp:50
pcl::SHOTLocalReferenceFrameEstimationOMP::threads_
unsigned int threads_
The number of threads the scheduler should use.
Definition
shot_lrf_omp.h:108
pcl::SHOTLocalReferenceFrameEstimationOMP::computeFeature
void computeFeature(PointCloudOut &output) override
Feature estimation method.
Definition
shot_lrf_omp.hpp:62
pcl::SHOTLocalReferenceFrameEstimationOMP::setNumberOfThreads
void setNumberOfThreads(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.
Definition
shot_lrf_omp.hpp:48
pcl::SHOTLocalReferenceFrameEstimationOMP::PointCloudOut
typename Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition
shot_lrf_omp.h:99