Point Cloud Library (PCL)  1.11.0
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 
46 namespace pcl
47 {
48 
49 namespace registration
50 {
51 
52 template <typename FeatureT> inline void
54  const typename pcl::PointCloud<FeatureT>::ConstPtr &source_feature, const std::string &key)
55 {
56  if (features_map_.count (key) == 0)
58  boost::static_pointer_cast<FeatureContainer<FeatureT> > (features_map_[key])->setSourceFeature (source_feature);
59 }
60 
61 
62 template <typename FeatureT> inline typename pcl::PointCloud<FeatureT>::ConstPtr
64 {
65  if (features_map_.count (key) == 0)
66  return (nullptr);
67  return (boost::static_pointer_cast<FeatureContainer<FeatureT> > (features_map_[key])->getSourceFeature ());
68 }
69 
70 
71 template <typename FeatureT> inline void
73  const typename pcl::PointCloud<FeatureT>::ConstPtr &target_feature, const std::string &key)
74 {
75  if (features_map_.count (key) == 0)
77  boost::static_pointer_cast<FeatureContainer<FeatureT> > (features_map_[key])->setTargetFeature (target_feature);
78 }
79 
80 
81 template <typename FeatureT> inline typename pcl::PointCloud<FeatureT>::ConstPtr
83 {
84  if (features_map_.count (key) == 0)
85  return (nullptr);
86  return (boost::static_pointer_cast<FeatureContainer<FeatureT> > (features_map_[key])->getTargetFeature ());
87 }
88 
89 
90 template <typename FeatureT> inline void
92  double thresh, const std::string &key)
93 {
94  if (features_map_.count (key) == 0)
96  boost::static_pointer_cast<FeatureContainer<FeatureT> > (features_map_[key])->setDistanceThreshold (thresh);
97 }
98 
99 
100 template <typename FeatureT> inline void
103  const std::string &key)
104 {
105  if (features_map_.count (key) == 0)
106  features_map_[key].reset (new FeatureContainer<FeatureT>);
107  boost::static_pointer_cast<FeatureContainer<FeatureT> > (features_map_[key])->setFeatureRepresentation (fr);
108 }
109 
110 } // namespace registration
111 } // namespace pcl
112 
113 #endif /* PCL_REGISTRATION_IMPL_CORRESPONDENCE_REJECTION_FEATURES_HPP_ */
114 
pcl
Definition: convolution.h:46
pcl::registration::CorrespondenceRejectorFeatures::getTargetFeature
pcl::PointCloud< FeatureT >::ConstPtr getTargetFeature(const std::string &key)
Get a pointer to the source cloud's feature descriptors, specified by the given key.
Definition: correspondence_rejection_features.hpp:82
pcl::registration::CorrespondenceRejectorFeatures::getSourceFeature
pcl::PointCloud< FeatureT >::ConstPtr getSourceFeature(const std::string &key)
Get a pointer to the source cloud's feature descriptors, specified by the given key.
Definition: correspondence_rejection_features.hpp:63
pcl::PointRepresentation::ConstPtr
shared_ptr< const PointRepresentation< PointT > > ConstPtr
Definition: point_representation.h:79
pcl::registration::CorrespondenceRejectorFeatures::setTargetFeature
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.
Definition: correspondence_rejection_features.hpp:72
pcl::registration::CorrespondenceRejectorFeatures::features_map_
FeaturesMap features_map_
An STL map containing features to use when performing the correspondence search.
Definition: correspondence_rejection_features.h:171
pcl::registration::CorrespondenceRejectorFeatures::FeatureContainer
An inner class containing pointers to the source and target feature clouds and the parameters needed ...
Definition: correspondence_rejection_features.h:181
pcl::registration::CorrespondenceRejectorFeatures::setFeatureRepresentation
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.
Definition: correspondence_rejection_features.hpp:101
pcl::registration::CorrespondenceRejectorFeatures::setSourceFeature
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.
Definition: correspondence_rejection_features.hpp:53
pcl::PointCloud::ConstPtr
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:429
pcl::registration::CorrespondenceRejectorFeatures::setDistanceThreshold
void setDistanceThreshold(double thresh, const std::string &key)
Set a hard distance threshold in the feature FeatureT space, between source and target features.
Definition: correspondence_rejection_features.hpp:91