Point Cloud Library (PCL)  1.11.1
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 
42 #ifndef PCL_REGISTRATION_IMPL_CORRESPONDENCE_REJECTION_FEATURES_HPP_
43 #define PCL_REGISTRATION_IMPL_CORRESPONDENCE_REJECTION_FEATURES_HPP_
44 
45 #include <boost/pointer_cast.hpp> // for static_pointer_cast
46 
47 namespace pcl
48 {
49 
50 namespace registration
51 {
52 
53 template <typename FeatureT> inline void
55  const typename pcl::PointCloud<FeatureT>::ConstPtr &source_feature, const std::string &key)
56 {
57  if (features_map_.count (key) == 0)
59  boost::static_pointer_cast<FeatureContainer<FeatureT> > (features_map_[key])->setSourceFeature (source_feature);
60 }
61 
62 
63 template <typename FeatureT> inline typename pcl::PointCloud<FeatureT>::ConstPtr
65 {
66  if (features_map_.count (key) == 0)
67  return (nullptr);
68  return (boost::static_pointer_cast<FeatureContainer<FeatureT> > (features_map_[key])->getSourceFeature ());
69 }
70 
71 
72 template <typename FeatureT> inline void
74  const typename pcl::PointCloud<FeatureT>::ConstPtr &target_feature, const std::string &key)
75 {
76  if (features_map_.count (key) == 0)
78  boost::static_pointer_cast<FeatureContainer<FeatureT> > (features_map_[key])->setTargetFeature (target_feature);
79 }
80 
81 
82 template <typename FeatureT> inline typename pcl::PointCloud<FeatureT>::ConstPtr
84 {
85  if (features_map_.count (key) == 0)
86  return (nullptr);
87  return (boost::static_pointer_cast<FeatureContainer<FeatureT> > (features_map_[key])->getTargetFeature ());
88 }
89 
90 
91 template <typename FeatureT> inline void
93  double thresh, const std::string &key)
94 {
95  if (features_map_.count (key) == 0)
97  boost::static_pointer_cast<FeatureContainer<FeatureT> > (features_map_[key])->setDistanceThreshold (thresh);
98 }
99 
100 
101 template <typename FeatureT> inline void
104  const std::string &key)
105 {
106  if (features_map_.count (key) == 0)
107  features_map_[key].reset (new FeatureContainer<FeatureT>);
108  boost::static_pointer_cast<FeatureContainer<FeatureT> > (features_map_[key])->setFeatureRepresentation (fr);
109 }
110 
111 } // namespace registration
112 } // namespace pcl
113 
114 #endif /* PCL_REGISTRATION_IMPL_CORRESPONDENCE_REJECTION_FEATURES_HPP_ */
115 
pcl::PointCloud< FeatureT >::ConstPtr getSourceFeature(const std::string &key)
Get a pointer to the source cloud&#39;s feature descriptors, specified by the given key.
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...
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.
pcl::PointCloud< FeatureT >::ConstPtr getTargetFeature(const std::string &key)
Get a pointer to the source cloud&#39;s feature descriptors, specified by the given key.
shared_ptr< const PointRepresentation< PointT > > ConstPtr
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...
void setDistanceThreshold(double thresh, const std::string &key)
Set a hard distance threshold in the feature FeatureT space, between source and target features...
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:430
An inner class containing pointers to the source and target feature clouds and the parameters needed ...