00001 00059 /* 00060 * registration_icp_narf.h 00061 * 00062 * Created on: Nov 15, 2011 00063 * Author: goa-jh 00064 */ 00065 00066 #ifndef REGISTRATION_ICP_NARF_H_ 00067 #define REGISTRATION_ICP_NARF_H_ 00068 00069 #include "registration_icp.h" 00070 #include "features/narf.h" 00071 00072 00073 namespace cob_3d_registration { 00074 00075 template <typename Point> 00076 class Registration_ICP_NARF : public Registration_ICP_Features<Point> 00077 { 00078 Feature_NARF<Point> *mom_; 00079 pcl::PointCloud<Point> tmp_input_; 00080 00081 public: 00082 Registration_ICP_NARF(): 00083 mom_(new Feature_NARF<Point>) 00084 { 00085 this->setCorrDist(0.1); 00086 this->setFeatures(mom_); 00087 } 00088 00089 virtual ~Registration_ICP_NARF() { 00090 delete mom_; 00091 } 00092 00093 virtual boost::shared_ptr<const pcl::PointCloud<Point> > getMarkers() {return this->input_;} 00094 00095 protected: 00096 virtual bool compute_features() { 00097 //save input first 00098 tmp_input_ = *this->input_; 00099 00100 //transform pc first 00101 if(!this->Registration_ICP_Features<Point>::compute_features()) 00102 return false; 00103 00104 mom_->setSearchRadius(this->icp_max_corr_dist_); 00105 if(this->register_.size()>0) { 00106 mom_->build(this->register_, *this->input_); 00107 } 00108 00109 return true; 00110 } 00111 00112 virtual bool compute_transformation() { 00113 ROS_INFO("compute_transformation"); 00114 bool b; 00115 00116 if(this->register_.size()>0) { 00117 pcl::PointCloud<Point> tmp = this->register_; 00118 00119 //replace input cloud... 00120 this->register_= mom_->getFilteredInputCloud(); 00121 this->input_ = mom_->getFilteredOutputCloud().makeShared(); 00122 00123 b=Registration_ICP_Features<Point>::compute_transformation(); 00124 00125 this->register_ = tmp; 00126 if(b) { 00127 pcl::transformPointCloud(tmp_input_, tmp_input_, this->transformation_); 00128 this->register_+= tmp_input_; 00129 } 00130 00131 } 00132 else 00133 b=Registration_ICP_Features<Point>::compute_transformation(); 00134 00135 ROS_INFO("done"); 00136 return b; 00137 } 00138 }; 00139 00140 } 00141 00142 #endif /* REGISTRATION_ICP_NARF_H_ */