correspondence_rejection_var_trimmed.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Point Cloud Library (PCL) - www.pointclouds.org
00005  *  Copyright (c) 2012, Open Perception, Inc.
00006  *
00007  *  All rights reserved.
00008  *
00009  *  Redistribution and use in source and binary forms, with or without
00010  *  modification, are permitted provided that the following conditions
00011  *  are met:
00012  *
00013  *   * Redistributions of source code must retain the above copyright
00014  *     notice, this list of conditions and the following disclaimer.
00015  *   * Redistributions in binary form must reproduce the above
00016  *     copyright notice, this list of conditions and the following
00017  *     disclaimer in the documentation and/or other materials provided
00018  *     with the distribution.
00019  *   * Neither the name of Open Perception, Inc. nor the names of its
00020  *     contributors may be used to endorse or promote products derived
00021  *     from this software without specific prior written permission.
00022  *
00023  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00024  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00025  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00026  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00027  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00028  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00029  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00030  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00031  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00032  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00033  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00034  *  POSSIBILITY OF SUCH DAMAGE.
00035  *
00036  * $Id$
00037  *
00038  */
00039 #ifndef PCL_REGISTRATION_CORRESPONDENCE_REJECTION_VAR_TRIMMED_H_
00040 #define PCL_REGISTRATION_CORRESPONDENCE_REJECTION_VAR_TRIMMED_H_
00041 
00042 #include <pcl/registration/correspondence_rejection.h>
00043 #include <pcl/point_cloud.h>
00044 
00045 #include <vector>
00046 
00047 namespace pcl
00048 {
00049   namespace registration
00050   {
00064     class PCL_EXPORTS CorrespondenceRejectorVarTrimmed: public CorrespondenceRejector
00065     {
00066       using CorrespondenceRejector::input_correspondences_;
00067       using CorrespondenceRejector::rejection_name_;
00068       using CorrespondenceRejector::getClassName;
00069 
00070       public:
00071         typedef boost::shared_ptr<CorrespondenceRejectorVarTrimmed> Ptr;
00072         typedef boost::shared_ptr<const CorrespondenceRejectorVarTrimmed> ConstPtr;
00073 
00075         CorrespondenceRejectorVarTrimmed () : 
00076           trimmed_distance_ (0), 
00077           factor_ (),
00078           min_ratio_ (0.05),
00079           max_ratio_ (0.95),
00080           lambda_ (0.95),
00081           data_container_ ()
00082         {
00083           rejection_name_ = "CorrespondenceRejectorVarTrimmed";
00084         }
00085 
00090         void 
00091         getRemainingCorrespondences (const pcl::Correspondences& original_correspondences, 
00092                                      pcl::Correspondences& remaining_correspondences);
00093 
00095         inline double
00096         getTrimmedDistance () const { return trimmed_distance_; };
00097 
00102         template <typename PointT> inline void 
00103         setInputSource (const typename pcl::PointCloud<PointT>::ConstPtr &cloud)
00104         {
00105           if (!data_container_)
00106             data_container_.reset (new DataContainer<PointT>);
00107           boost::static_pointer_cast<DataContainer<PointT> > (data_container_)->setInputSource (cloud);
00108         }
00109 
00114         template <typename PointT> inline void 
00115         setInputCloud (const typename pcl::PointCloud<PointT>::ConstPtr &cloud)
00116         {
00117           PCL_WARN ("[pcl::registration::%s::setInputCloud] setInputCloud is deprecated. Please use setInputSource instead.\n", getClassName ().c_str ());
00118           if (!data_container_)
00119             data_container_.reset (new DataContainer<PointT>);
00120           boost::static_pointer_cast<DataContainer<PointT> > (data_container_)->setInputSource (cloud);
00121         }
00122 
00127         template <typename PointT> inline void 
00128         setInputTarget (const typename pcl::PointCloud<PointT>::ConstPtr &target)
00129         {
00130           if (!data_container_)
00131             data_container_.reset (new DataContainer<PointT>);
00132           boost::static_pointer_cast<DataContainer<PointT> > (data_container_)->setInputTarget (target);
00133         }
00134         
00142         template <typename PointT> inline void
00143         setSearchMethodTarget (const boost::shared_ptr<pcl::search::KdTree<PointT> > &tree, 
00144                                bool force_no_recompute = false) 
00145         { 
00146           boost::static_pointer_cast< DataContainer<PointT> > 
00147             (data_container_)->setSearchMethodTarget (tree, force_no_recompute );
00148         }
00149 
00151         inline double
00152         getTrimFactor () const { return factor_; }
00153 
00157         inline void
00158         setMinRatio (double ratio) { min_ratio_ = ratio; }
00159 
00162         inline double
00163         getMinRatio () const { return min_ratio_; }
00164 
00168         inline void
00169         setMaxRatio (double ratio) { max_ratio_ = ratio; }
00170 
00173         inline double
00174         getMaxRatio () const { return max_ratio_; }
00175 
00176       protected:
00177 
00181         inline void 
00182         applyRejection (pcl::Correspondences &correspondences)
00183         {
00184           getRemainingCorrespondences (*input_correspondences_, correspondences);
00185         }
00186 
00189         double trimmed_distance_;
00190 
00195         double factor_;
00196 
00199         double min_ratio_;
00200 
00203         double max_ratio_;
00204 
00207         double lambda_;
00208 
00209         typedef boost::shared_ptr<DataContainerInterface> DataContainerPtr;
00210 
00212         DataContainerPtr data_container_;
00213 
00214       private:
00215 
00218         inline float optimizeInlierRatio (std::vector <double> &dists);
00219     };
00220   }
00221 }
00222 
00223 #include <pcl/registration/impl/correspondence_rejection_var_trimmed.hpp>
00224 
00225 #endif    // PCL_REGISTRATION_CORRESPONDENCE_REJECTION_VAR_TRIMMED_H_ 


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:23:13