covariance_sampling.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) 2009-2012, Willow Garage, Inc.
00006  * Copyright (c) 2012-, Open Perception, Inc.
00007 
00008  * All rights reserved.
00009 
00010  * Redistribution and use in source and binary forms, with or without
00011  * modification, are permitted provided that the following conditions
00012  * are met:
00013  *
00014  *  * Redistributions of source code must retain the above copyright
00015  *    notice, this list of conditions and the following disclaimer.
00016  *  * Redistributions in binary form must reproduce the above
00017  *    copyright notice, this list of conditions and the following
00018  *    disclaimer in the documentation and/or other materials provided
00019  *    with the distribution.
00020  * * Neither the name of the copyright holder(s) nor the names of its
00021  *    contributors may be used to endorse or promote products derived
00022  *    from this software without specific prior written permission.
00023  *
00024  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00025  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00026  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00027  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00028  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00029  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00030  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00031  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00032  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00033  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00034  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00035  * POSSIBILITY OF SUCH DAMAGE.
00036  *
00037  * $Id$
00038  *
00039  */
00040 
00041 
00042 #ifndef PCL_FILTERS_COVARIANCE_SAMPLING_H_
00043 #define PCL_FILTERS_COVARIANCE_SAMPLING_H_
00044 
00045 #include <pcl/filters/filter_indices.h>
00046 
00047 namespace pcl
00048 {
00061   template <typename PointT, typename PointNT>
00062   class CovarianceSampling : public FilterIndices<PointT>
00063   {
00064       using FilterIndices<PointT>::filter_name_;
00065       using FilterIndices<PointT>::getClassName;
00066       using FilterIndices<PointT>::indices_;
00067       using FilterIndices<PointT>::input_;
00068       using FilterIndices<PointT>::initCompute;
00069 
00070       typedef typename FilterIndices<PointT>::PointCloud Cloud;
00071       typedef typename Cloud::Ptr CloudPtr;
00072       typedef typename Cloud::ConstPtr CloudConstPtr;
00073       typedef typename pcl::PointCloud<PointNT>::ConstPtr NormalsConstPtr;
00074 
00075     public:
00076       typedef boost::shared_ptr< CovarianceSampling<PointT, PointNT> > Ptr;
00077       typedef boost::shared_ptr< const CovarianceSampling<PointT, PointNT> > ConstPtr;
00078  
00080       CovarianceSampling ()
00081       { filter_name_ = "CovarianceSampling"; }
00082 
00086       inline void
00087       setNumberOfSamples (unsigned int samples)
00088       { num_samples_ = samples; }
00089 
00091       inline unsigned int
00092       getNumberOfSamples () const
00093       { return (num_samples_); }
00094 
00098       inline void
00099       setNormals (const NormalsConstPtr &normals)
00100       { input_normals_ = normals; }
00101 
00103       inline NormalsConstPtr
00104       getNormals () const
00105       { return (input_normals_); }
00106 
00107 
00108 
00114       double
00115       computeConditionNumber ();
00116 
00123       static double
00124       computeConditionNumber (const Eigen::Matrix<double, 6, 6> &covariance_matrix);
00125 
00130       bool
00131       computeCovarianceMatrix (Eigen::Matrix<double, 6, 6> &covariance_matrix);
00132 
00133     protected:
00135       unsigned int num_samples_;
00136 
00138       NormalsConstPtr input_normals_;
00139 
00140       std::vector<Eigen::Vector3f> scaled_points_;
00141 
00142       bool
00143       initCompute ();
00144 
00148       void
00149       applyFilter (Cloud &output);
00150 
00154       void
00155       applyFilter (std::vector<int> &indices);
00156 
00157       static bool
00158       sort_dot_list_function (std::pair<int, double> a,
00159                               std::pair<int, double> b)
00160       { return (a.second > b.second); }
00161 
00162     public:
00163       EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00164   };
00165 }
00166 
00167 #ifdef PCL_NO_PRECOMPILE
00168 #include <pcl/filters/impl/covariance_sampling.hpp>
00169 #endif
00170 
00171 
00172 #endif /* PCL_FILTERS_COVARIANCE_SAMPLING_H_ */


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