Point Cloud Library (PCL)  1.14.1-dev
correspondence_rejection_features.hpp
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010-2011, 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 
41 #ifndef PCL_REGISTRATION_IMPL_CORRESPONDENCE_REJECTION_FEATURES_HPP_
42 #define PCL_REGISTRATION_IMPL_CORRESPONDENCE_REJECTION_FEATURES_HPP_
43 
44 #include <boost/pointer_cast.hpp> // for static_pointer_cast
45 
46 namespace pcl {
47 
48 namespace registration {
49 
50 template <typename FeatureT>
51 inline void
53  const typename pcl::PointCloud<FeatureT>::ConstPtr& source_feature,
54  const std::string& key)
55 {
56  if (features_map_.count(key) == 0)
58  boost::static_pointer_cast<FeatureContainer<FeatureT>>(features_map_[key])
59  ->setSourceFeature(source_feature);
60 }
61 
62 template <typename FeatureT>
65 {
66  if (features_map_.count(key) == 0)
67  return (nullptr);
68  return (boost::static_pointer_cast<FeatureContainer<FeatureT>>(features_map_[key])
69  ->getSourceFeature());
70 }
71 
72 template <typename FeatureT>
73 inline void
75  const typename pcl::PointCloud<FeatureT>::ConstPtr& target_feature,
76  const std::string& key)
77 {
78  if (features_map_.count(key) == 0)
80  boost::static_pointer_cast<FeatureContainer<FeatureT>>(features_map_[key])
81  ->setTargetFeature(target_feature);
82 }
83 
84 template <typename FeatureT>
87 {
88  if (features_map_.count(key) == 0)
89  return (nullptr);
90  return (boost::static_pointer_cast<FeatureContainer<FeatureT>>(features_map_[key])
91  ->getTargetFeature());
92 }
93 
94 template <typename FeatureT>
95 inline void
97  const std::string& key)
98 {
99  if (features_map_.count(key) == 0)
101  boost::static_pointer_cast<FeatureContainer<FeatureT>>(features_map_[key])
102  ->setDistanceThreshold(thresh);
103 }
104 
105 template <typename FeatureT>
106 inline void
109  const std::string& key)
110 {
111  if (features_map_.count(key) == 0)
113  boost::static_pointer_cast<FeatureContainer<FeatureT>>(features_map_[key])
115 }
116 
117 } // namespace registration
118 } // namespace pcl
119 
120 #endif /* PCL_REGISTRATION_IMPL_CORRESPONDENCE_REJECTION_FEATURES_HPP_ */
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:414
shared_ptr< const PointRepresentation< PointT > > ConstPtr
An inner class containing pointers to the source and target feature clouds and the parameters needed ...
void setFeatureRepresentation(const typename pcl::PointRepresentation< FeatureT >::ConstPtr &fr, const std::string &key)
Provide a boost shared pointer to a PointRepresentation to be used when comparing features.
pcl::PointCloud< FeatureT >::ConstPtr getSourceFeature(const std::string &key)
Get a pointer to the source cloud's feature descriptors, specified by the given key.
void setTargetFeature(const typename pcl::PointCloud< FeatureT >::ConstPtr &target_feature, const std::string &key)
Provide a pointer to a cloud of feature descriptors associated with the target point cloud.
FeaturesMap features_map_
An STL map containing features to use when performing the correspondence search.
void setDistanceThreshold(double thresh, const std::string &key)
Set a hard distance threshold in the feature FeatureT space, between source and target features.
void setSourceFeature(const typename pcl::PointCloud< FeatureT >::ConstPtr &source_feature, const std::string &key)
Provide a pointer to a cloud of feature descriptors associated with the source point cloud.
pcl::PointCloud< FeatureT >::ConstPtr getTargetFeature(const std::string &key)
Get a pointer to the source cloud's feature descriptors, specified by the given key.