Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef PCL_REGISTRATION_CORRESPONDENCE_REJECTION_SURFACE_NORMAL_H_
00040 #define PCL_REGISTRATION_CORRESPONDENCE_REJECTION_SURFACE_NORMAL_H_
00041
00042 #include <pcl/registration/correspondence_rejection.h>
00043 #include <pcl/point_cloud.h>
00044
00045 namespace pcl
00046 {
00047 namespace registration
00048 {
00060 class PCL_EXPORTS CorrespondenceRejectorSurfaceNormal: public CorrespondenceRejector
00061 {
00062 using CorrespondenceRejector::input_correspondences_;
00063 using CorrespondenceRejector::rejection_name_;
00064 using CorrespondenceRejector::getClassName;
00065
00066 public:
00067 typedef boost::shared_ptr<CorrespondenceRejectorSurfaceNormal> Ptr;
00068 typedef boost::shared_ptr<const CorrespondenceRejectorSurfaceNormal> ConstPtr;
00069
00071 CorrespondenceRejectorSurfaceNormal ()
00072 : threshold_ (1.0)
00073 , data_container_ ()
00074 {
00075 rejection_name_ = "CorrespondenceRejectorSurfaceNormal";
00076 }
00077
00082 void
00083 getRemainingCorrespondences (const pcl::Correspondences& original_correspondences,
00084 pcl::Correspondences& remaining_correspondences);
00085
00089 inline void
00090 setThreshold (double threshold) { threshold_ = threshold; };
00091
00093 inline double
00094 getThreshold () const { return threshold_; };
00095
00097 template <typename PointT, typename NormalT> inline void
00098 initializeDataContainer ()
00099 {
00100 data_container_.reset (new DataContainer<PointT, NormalT>);
00101 }
00102
00106 template <typename PointT> inline void
00107 setInputCloud (const typename pcl::PointCloud<PointT>::ConstPtr &input)
00108 {
00109 PCL_WARN ("[pcl::registration::%s::setInputCloud] setInputCloud is deprecated. Please use setInputSource instead.\n", getClassName ().c_str ());
00110 if (!data_container_)
00111 {
00112 PCL_ERROR ("[pcl::registration::%s::setInputCloud] Initialize the data container object by calling intializeDataContainer () before using this function.\n", getClassName ().c_str ());
00113 return;
00114 }
00115 boost::static_pointer_cast<DataContainer<PointT> > (data_container_)->setInputSource (input);
00116 }
00117
00121 template <typename PointT> inline void
00122 setInputSource (const typename pcl::PointCloud<PointT>::ConstPtr &input)
00123 {
00124 if (!data_container_)
00125 {
00126 PCL_ERROR ("[pcl::registration::%s::setInputCloud] Initialize the data container object by calling intializeDataContainer () before using this function.\n", getClassName ().c_str ());
00127 return;
00128 }
00129 boost::static_pointer_cast<DataContainer<PointT> > (data_container_)->setInputSource (input);
00130 }
00131
00133 template <typename PointT> inline typename pcl::PointCloud<PointT>::ConstPtr
00134 getInputSource () const
00135 {
00136 if (!data_container_)
00137 {
00138 PCL_ERROR ("[pcl::registration::%s::getInputSource] Initialize the data container object by calling intializeDataContainer () before using this function.\n", getClassName ().c_str ());
00139 return;
00140 }
00141 return (boost::static_pointer_cast<DataContainer<PointT> > (data_container_)->getInputSource ());
00142 }
00143
00147 template <typename PointT> inline void
00148 setInputTarget (const typename pcl::PointCloud<PointT>::ConstPtr &target)
00149 {
00150 if (!data_container_)
00151 {
00152 PCL_ERROR ("[pcl::registration::%s::setInputTarget] Initialize the data container object by calling intializeDataContainer () before using this function.\n", getClassName ().c_str ());
00153 return;
00154 }
00155 boost::static_pointer_cast<DataContainer<PointT> > (data_container_)->setInputTarget (target);
00156 }
00157
00165 template <typename PointT> inline void
00166 setSearchMethodTarget (const boost::shared_ptr<pcl::search::KdTree<PointT> > &tree,
00167 bool force_no_recompute = false)
00168 {
00169 boost::static_pointer_cast< DataContainer<PointT> >
00170 (data_container_)->setSearchMethodTarget (tree, force_no_recompute );
00171 }
00172
00174 template <typename PointT> inline typename pcl::PointCloud<PointT>::ConstPtr
00175 getInputTarget () const
00176 {
00177 if (!data_container_)
00178 {
00179 PCL_ERROR ("[pcl::registration::%s::getInputTarget] Initialize the data container object by calling intializeDataContainer () before using this function.\n", getClassName ().c_str ());
00180 return;
00181 }
00182 return (boost::static_pointer_cast<DataContainer<PointT> > (data_container_)->getInputTarget ());
00183 }
00184
00188 template <typename PointT, typename NormalT> inline void
00189 setInputNormals (const typename pcl::PointCloud<NormalT>::ConstPtr &normals)
00190 {
00191 if (!data_container_)
00192 {
00193 PCL_ERROR ("[pcl::registration::%s::setInputNormals] Initialize the data container object by calling intializeDataContainer () before using this function.\n", getClassName ().c_str ());
00194 return;
00195 }
00196 boost::static_pointer_cast<DataContainer<PointT, NormalT> > (data_container_)->setInputNormals (normals);
00197 }
00198
00200 template <typename NormalT> inline typename pcl::PointCloud<NormalT>::Ptr
00201 getInputNormals () const
00202 {
00203 if (!data_container_)
00204 {
00205 PCL_ERROR ("[pcl::registration::%s::getInputNormals] Initialize the data container object by calling intializeDataContainer () before using this function.\n", getClassName ().c_str ());
00206 return;
00207 }
00208 return (boost::static_pointer_cast<DataContainer<pcl::PointXYZ, NormalT> > (data_container_)->getInputNormals ());
00209 }
00210
00214 template <typename PointT, typename NormalT> inline void
00215 setTargetNormals (const typename pcl::PointCloud<NormalT>::ConstPtr &normals)
00216 {
00217 if (!data_container_)
00218 {
00219 PCL_ERROR ("[pcl::registration::%s::setTargetNormals] Initialize the data container object by calling intializeDataContainer () before using this function.\n", getClassName ().c_str ());
00220 return;
00221 }
00222 boost::static_pointer_cast<DataContainer<PointT, NormalT> > (data_container_)->setTargetNormals (normals);
00223 }
00224
00226 template <typename NormalT> inline typename pcl::PointCloud<NormalT>::Ptr
00227 getTargetNormals () const
00228 {
00229 if (!data_container_)
00230 {
00231 PCL_ERROR ("[pcl::registration::%s::getTargetNormals] Initialize the data container object by calling intializeDataContainer () before using this function.\n", getClassName ().c_str ());
00232 return;
00233 }
00234 return (boost::static_pointer_cast<DataContainer<pcl::PointXYZ, NormalT> > (data_container_)->getTargetNormals ());
00235 }
00236
00237 protected:
00238
00242 inline void
00243 applyRejection (pcl::Correspondences &correspondences)
00244 {
00245 getRemainingCorrespondences (*input_correspondences_, correspondences);
00246 }
00247
00249 double threshold_;
00250
00251 typedef boost::shared_ptr<DataContainerInterface> DataContainerPtr;
00253 DataContainerPtr data_container_;
00254 };
00255 }
00256 }
00257
00258 #include <pcl/registration/impl/correspondence_rejection_surface_normal.hpp>
00259
00260 #endif