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  *
00037  */
00038 #ifndef PCL_REGISTRATION_CORRESPONDENCE_REJECTION_VAR_TRIMMED_H_
00039 #define PCL_REGISTRATION_CORRESPONDENCE_REJECTION_VAR_TRIMMED_H_
00040 
00041 #include <pcl/registration/correspondence_rejection.h>
00042 #include <pcl/point_cloud.h>
00043 
00044 #include <vector>
00045 
00046 namespace pcl
00047 {
00048   namespace registration
00049   {
00063     class CorrespondenceRejectorVarTrimmed: public CorrespondenceRejector
00064     {
00065       using CorrespondenceRejector::input_correspondences_;
00066       using CorrespondenceRejector::rejection_name_;
00067       using CorrespondenceRejector::getClassName;
00068 
00069       public:
00070 
00072         CorrespondenceRejectorVarTrimmed () : trimmed_distance_(0), 
00073                                             min_ratio_ (0.05),
00074                                             max_ratio_ (0.95),
00075                                             lambda_ (0.95),
00076                                             data_container_ ()
00077         {
00078           rejection_name_ = "CorrespondenceRejectorVarTrimmed";
00079         }
00080 
00085         inline void 
00086         getRemainingCorrespondences (const pcl::Correspondences& original_correspondences, 
00087                                      pcl::Correspondences& remaining_correspondences);
00088 
00090         inline double
00091         getTrimmedDistance () const { return trimmed_distance_; };
00092 
00097         template <typename PointT> inline void 
00098         setInputCloud (const typename pcl::PointCloud<PointT>::ConstPtr &cloud)
00099         {
00100           if (!data_container_)
00101             data_container_.reset (new DataContainer<PointT>);
00102           boost::static_pointer_cast<DataContainer<PointT> > (data_container_)->setInputCloud (cloud);
00103         }
00104 
00109         template <typename PointT> inline void 
00110         setInputTarget (const typename pcl::PointCloud<PointT>::ConstPtr &target)
00111         {
00112           if (!data_container_)
00113             data_container_.reset (new DataContainer<PointT>);
00114           boost::static_pointer_cast<DataContainer<PointT> > (data_container_)->setInputTarget (target);
00115         }
00116 
00118         inline double
00119         getTrimFactor () const { return factor_; }
00120 
00124         inline void
00125         setMinRatio (double ratio) { min_ratio_ = ratio; }
00126 
00129         inline double
00130         getMinRatio () const { return min_ratio_; }
00131 
00135         inline void
00136         setMaxRatio (double ratio) { max_ratio_ = ratio; }
00137 
00140         inline double
00141         getMaxRatio () const { return max_ratio_; }
00142 
00143       protected:
00144 
00148         inline void 
00149         applyRejection (pcl::Correspondences &correspondences)
00150         {
00151           getRemainingCorrespondences (*input_correspondences_, correspondences);
00152         }
00153 
00156         double trimmed_distance_;
00157 
00162         double factor_;
00163 
00166         double min_ratio_;
00167 
00170         double max_ratio_;
00171 
00174         double lambda_;
00175 
00176         typedef boost::shared_ptr<DataContainerInterface> DataContainerPtr;
00177 
00179         DataContainerPtr data_container_;
00180 
00181       private:
00182 
00185         float optimizeInlierRatio (std::vector <double> &dists);
00186     };
00187   }
00188 }
00189 
00190 #include <pcl/registration/impl/correspondence_rejection_var_trimmed.hpp>
00191 
00192 #endif


pcl
Author(s): Open Perception
autogenerated on Mon Oct 6 2014 03:14:46