00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Point Cloud Library (PCL) - www.pointclouds.org 00005 * Copyright (c) 2009-2012, Willow Garage, Inc. 00006 * Copyright (c) 2012-, Open Perception, Inc. 00007 * Copyright (c) Alexandru-Eugen Ichim 00008 * 00009 * All rights reserved. 00010 * 00011 * Redistribution and use in source and binary forms, with or without 00012 * modification, are permitted provided that the following conditions 00013 * are met: 00014 * 00015 * * Redistributions of source code must retain the above copyright 00016 * notice, this list of conditions and the following disclaimer. 00017 * * Redistributions in binary form must reproduce the above 00018 * copyright notice, this list of conditions and the following 00019 * disclaimer in the documentation and/or other materials provided 00020 * with the distribution. 00021 * * Neither the name of the copyright holder(s) nor the names of its 00022 * contributors may be used to endorse or promote products derived 00023 * from this software without specific prior written permission. 00024 * 00025 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00026 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00027 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00028 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00029 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00030 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00031 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00032 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00033 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00034 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00035 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00036 * POSSIBILITY OF SUCH DAMAGE. 00037 */ 00038 00039 #ifndef PCL_REGISTRATION_CORRESPONDENCE_REJECTION_ORGANIZED_BOUNDARY_H_ 00040 #define PCL_REGISTRATION_CORRESPONDENCE_REJECTION_ORGANIZED_BOUNDARY_H_ 00041 00042 #include <pcl/registration/correspondence_rejection.h> 00043 00044 00045 namespace pcl 00046 { 00047 namespace registration 00048 { 00059 class PCL_EXPORTS CorrespondenceRejectionOrganizedBoundary : public CorrespondenceRejector 00060 { 00061 public: 00063 CorrespondenceRejectionOrganizedBoundary () 00064 : boundary_nans_threshold_ (8) 00065 , window_size_ (5) 00066 , depth_step_threshold_ (0.025f) 00067 , data_container_ () 00068 { } 00069 00070 void 00071 getRemainingCorrespondences (const pcl::Correspondences& original_correspondences, 00072 pcl::Correspondences& remaining_correspondences); 00073 00074 inline void 00075 setNumberOfBoundaryNaNs (int val) 00076 { boundary_nans_threshold_ = val; } 00077 00078 00079 template <typename PointT> inline void 00080 setInputSource (const typename pcl::PointCloud<PointT>::ConstPtr &cloud) 00081 { 00082 if (!data_container_) 00083 data_container_.reset (new pcl::registration::DataContainer<PointT>); 00084 boost::static_pointer_cast<pcl::registration::DataContainer<PointT> > (data_container_)->setInputSource (cloud); 00085 } 00086 00087 template <typename PointT> inline void 00088 setInputTarget (const typename pcl::PointCloud<PointT>::ConstPtr &cloud) 00089 { 00090 if (!data_container_) 00091 data_container_.reset (new pcl::registration::DataContainer<PointT>); 00092 boost::static_pointer_cast<pcl::registration::DataContainer<PointT> > (data_container_)->setInputTarget (cloud); 00093 } 00094 00095 virtual bool 00096 updateSource (const Eigen::Matrix4d &) 00097 { return (true); } 00098 00099 protected: 00100 00104 inline void 00105 applyRejection (pcl::Correspondences &correspondences) 00106 { getRemainingCorrespondences (*input_correspondences_, correspondences); } 00107 00108 int boundary_nans_threshold_; 00109 int window_size_; 00110 float depth_step_threshold_; 00111 00112 typedef boost::shared_ptr<pcl::registration::DataContainerInterface> DataContainerPtr; 00113 DataContainerPtr data_container_; 00114 }; 00115 } 00116 } 00117 00118 #include <pcl/registration/impl/correspondence_rejection_organized_boundary.hpp> 00119 00120 00121 #endif /* PCL_REGISTRATION_CORRESPONDENCE_REJECTION_ORGANIZED_BOUNDARY_H_ */