edges.h
Go to the documentation of this file.
00001 
00059 /*
00060  * edges.h
00061  *
00062  *  Created on: Nov 18, 2011
00063  *      Author: goa-jh
00064  */
00065 
00066 #ifndef EDGES_H_
00067 #define EDGES_H_
00068 
00069 
00070 #include "pcl/range_image/range_image.h"
00071 #include "pcl/features/range_image_border_extractor.h"
00072 #include "pcl/keypoints/narf_keypoint.h"
00073 #include "pcl/features/narf_descriptor.h"
00074 #include <pcl/filters/extract_indices.h>
00075 
00076 #include <pcl/features/normal_3d.h>
00077 #include <cob_3d_features/fast_edge_estimation_3d_omp.h>
00078 #include <cob_3d_mapping_common/point_types.h>
00079 #include <pcl/kdtree/kdtree.h>
00080 #include <pcl/features/integral_image_normal.h>
00081 
00082 #include <pcl/visualization/cloud_viewer.h>
00083 
00084 namespace cob_3d_registration {
00085 
00086 template<typename Point>
00087 class Feature_Edges : public FeatureContainerInterface_Euclidean<Point>
00088 {
00089   pcl::PointCloud<Point> feature_in_, feature_out_;
00090 
00091   float radius_;
00092   float thr_;
00093   float dist_threshold_;
00094 
00095 public:
00096   Feature_Edges():
00097     radius_(0.05), thr_(0.5), dist_threshold_(0.1)
00098   {}
00099 
00100   void setRadius(float v) {radius_ = v;}
00101   void setThreshold(float v) {thr_ = v;}
00102   void setDisThreshold(float v) {dist_threshold_ = v;}
00103 
00104   void extractFeatures(const pcl::PointCloud<Point>& point_cloud, pcl::PointCloud<Point> &narf_descriptors);
00105 
00106   const pcl::PointCloud<Point> &getFilteredInputCloud() {return this->org_in_;}
00107   const pcl::PointCloud<Point> &getFilteredOutputCloud() {return this->org_out_;}
00108 
00109   virtual bool hidden_build() {
00110 
00111     ROS_INFO("calc edges for source %d", (int)this->org_in_.size());
00112     {
00113       /*extractFeatures(this->org_in_, feature_in_);
00114       this->org_in_.points.clear();
00115       for(int i=0; i<feature_in_.size(); i++) {
00116         Point p;
00117         memset(&p,0,sizeof(Point));
00118         p.x=feature_in_.points[i].x;
00119         p.y=feature_in_.points[i].y;
00120         p.z=feature_in_.points[i].z;
00121         this->org_in_.points.push_back(p);
00122       }
00123       this->org_in_.height=1;
00124       this->org_in_.width=this->org_in_.size();*/
00125       feature_in_=this->org_in_;
00126     }
00127 
00128     ROS_INFO("calc edges for target %d", (int)this->org_out_.size());
00129     {
00130       extractFeatures(this->org_out_, feature_out_);
00131       this->org_out_.points.clear();
00132       for(int i=0; i<(int)feature_out_.size(); i++) {
00133         Point p;
00134         memset(&p,0,sizeof(Point));
00135         p.x=feature_out_.points[i].x;
00136         p.y=feature_out_.points[i].y;
00137         p.z=feature_out_.points[i].z;
00138         this->org_out_.points.push_back(p);
00139       }
00140       this->org_out_.height=1;
00141       this->org_out_.width=this->org_out_.size();
00142     }
00143 
00144     //need to rebuild tree
00145     //ROS_INFO("build tree %d %d", this->org_in_.size(), this->org_out_.size());
00146 #ifdef PCL_VERSION_COMPARE
00147     this->tree_.reset (new pcl::search::KdTree<Point>);
00148 #else
00149         this->tree_.reset (new pcl::KdTreeFLANN<Point>);
00150 #endif
00151     if(this->org_in_.size()>0) this->tree_->setInputCloud(this->org_in_.makeShared());
00152     //ROS_INFO("build tree done");
00153 
00154     return true;
00155   }
00156 
00157   virtual Eigen::VectorXf getFeatureOut(const int index) {
00158     return this->org_out_.points[index].getVector3fMap();
00159   }
00160   virtual Eigen::VectorXf getFeatureIn(const int index) {
00161     return this->org_in_.points[index].getVector3fMap();
00162   }
00163 };
00164 
00165 #include "impl/edges.hpp"
00166 }
00167 
00168 #endif /* EDGES_H_ */
00169 


cob_3d_registration
Author(s): Joshua Hampp
autogenerated on Wed Aug 26 2015 11:02:36