00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Point Cloud Library (PCL) - www.pointclouds.org 00005 * Copyright (c) 2009-2011, Willow Garage, 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 the copyright holder(s) 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_FILTERS_SHADOW_POINTS_FILTER_H_ 00039 #define PCL_FILTERS_SHADOW_POINTS_FILTER_H_ 00040 00041 #include <pcl/filters/filter_indices.h> 00042 #include <time.h> 00043 #include <limits.h> 00044 00045 namespace pcl 00046 { 00052 template<typename PointT, typename NormalT> 00053 class ShadowPoints : public FilterIndices<PointT> 00054 { 00055 using FilterIndices<PointT>::filter_name_; 00056 using FilterIndices<PointT>::getClassName; 00057 using FilterIndices<PointT>::indices_; 00058 using FilterIndices<PointT>::input_; 00059 using FilterIndices<PointT>::removed_indices_; 00060 using FilterIndices<PointT>::extract_removed_indices_; 00061 using FilterIndices<PointT>::negative_; 00062 using FilterIndices<PointT>::user_filter_value_; 00063 using FilterIndices<PointT>::keep_organized_; 00064 00065 typedef typename FilterIndices<PointT>::PointCloud PointCloud; 00066 typedef typename PointCloud::Ptr PointCloudPtr; 00067 typedef typename PointCloud::ConstPtr PointCloudConstPtr; 00068 typedef typename pcl::PointCloud<NormalT>::Ptr NormalsPtr; 00069 00070 public: 00071 00072 typedef boost::shared_ptr< ShadowPoints<PointT, NormalT> > Ptr; 00073 typedef boost::shared_ptr< const ShadowPoints<PointT, NormalT> > ConstPtr; 00074 00076 ShadowPoints (bool extract_removed_indices = false) : 00077 FilterIndices<PointT> (extract_removed_indices), 00078 input_normals_ (), 00079 threshold_ (0.1f) 00080 { 00081 filter_name_ = "ShadowPoints"; 00082 } 00083 00087 inline void 00088 setNormals (const NormalsPtr &normals) { input_normals_ = normals; } 00089 00091 inline NormalsPtr 00092 getNormals () const { return (input_normals_); } 00093 00097 inline void 00098 setThreshold (float threshold) { threshold_ = threshold; } 00099 00101 inline float 00102 getThreshold () const { return threshold_; } 00103 00104 protected: 00105 00107 NormalsPtr input_normals_; 00108 00112 void 00113 applyFilter (PointCloud &output); 00114 00118 void 00119 applyFilter (std::vector<int> &indices); 00120 00121 private: 00122 00125 float threshold_; 00126 }; 00127 } 00128 00129 #ifdef PCL_NO_PRECOMPILE 00130 #include <pcl/filters/impl/shadowpoints.hpp> 00131 #endif 00132 00133 #endif //#ifndef PCL_FILTERS_SHADOW_POINTS_FILTER_H_