00001 00060 #ifndef SPECKLE_FILTER_H_ 00061 #define SPECKLE_FILTER_H_ 00062 00063 //################## 00064 //#### includes #### 00065 00066 // PCL includes 00067 #include <pcl/pcl_base.h> 00068 #include <pcl/point_types.h> 00069 #include <pcl/filters/filter.h> 00070 00071 namespace cob_3d_mapping_filters 00072 { 00081 template<typename PointT> 00082 class SpeckleFilter : public pcl::Filter<PointT> 00083 { 00084 using pcl::Filter<PointT>::input_; 00085 00086 public: 00087 typedef typename pcl::Filter<PointT>::PointCloud PointCloud; 00088 typedef typename PointCloud::Ptr PointCloudPtr; 00089 typedef typename PointCloud::ConstPtr PointCloudConstPtr; 00090 00091 SpeckleFilter () : 00092 speckle_size_ (40), speckle_range_ (0.2) 00093 { 00094 points_to_remove_ = pcl::PointIndices::Ptr (new pcl::PointIndices ()); 00095 } 00096 ; 00097 00098 //virtual ~SpeckleFilter(); 00099 00106 inline void 00107 setFilterParam (int speckle_s, double speckle_r) 00108 { 00109 speckle_size_ = speckle_s; 00110 speckle_range_ = speckle_r; 00111 } 00112 00118 inline int 00119 getSpeckleSize () 00120 { 00121 return speckle_size_; 00122 } 00123 00129 inline double 00130 getSpeckleRange () 00131 { 00132 return speckle_range_; 00133 } 00134 00140 pcl::PointIndices::Ptr 00141 getRemovedIndices () 00142 { 00143 return points_to_remove_; 00144 } 00145 00146 protected: 00147 00153 void 00154 applyFilter (PointCloud &output); 00155 00156 int speckle_size_; 00157 double speckle_range_; 00158 pcl::PointIndices::Ptr points_to_remove_; 00159 }; 00160 00161 } // end namespace cob_3d_mapping_filters 00162 00163 #endif /* SPECKLE_FILTER_H_ */