00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 template <typename PointInT, typename PointOutT> inline void
00037 pcl::Keypoint<PointInT, PointOutT>::compute (PointCloudOut &output)
00038 {
00039 if (!initCompute ())
00040 {
00041 ROS_ERROR ("[pcl::%s::compute] initCompute failed!", getClassName ().c_str ());
00042 return;
00043 }
00044
00045
00046 if (!tree_)
00047 {
00048 ROS_ERROR ("[pcl::%s::compute] No spatial search method was given!", getClassName ().c_str ());
00049 return;
00050 }
00051
00052
00053 if (!surface_)
00054 {
00055 surface_ = input_;
00056 }
00057
00058
00059 tree_->setInputCloud (surface_);
00060
00061
00062 if (search_radius_ != 0.0)
00063 {
00064 if (k_ != 0)
00065 {
00066 ROS_ERROR ("[pcl::%s::compute] Both radius (%f) and K (%d) defined! Set one of them to zero first and then re-run compute ().", getClassName ().c_str (), search_radius_, k_);
00067 return;
00068 }
00069 else
00070 {
00071 search_parameter_ = search_radius_;
00072 if (surface_ == input_)
00073 {
00074
00075 int (KdTree::*radiusSearch)(int index, double radius, std::vector<int> &k_indices,
00076 std::vector<float> &k_distances, int max_nn) const = &KdTree::radiusSearch;
00077 search_method_ = boost::bind (radiusSearch, boost::ref (tree_), _1, _2, _3, _4, INT_MAX);
00078 }
00079 else
00080 {
00081
00082 int (KdTree::*radiusSearchSurface)(const PointCloudIn &cloud, int index, double radius, std::vector<int> &k_indices,
00083 std::vector<float> &k_distances, int max_nn) const = &KdTree::radiusSearch;
00084 search_method_surface_ = boost::bind (radiusSearchSurface, boost::ref (tree_), _1, _2, _3, _4, _5, INT_MAX);
00085 }
00086 }
00087 }
00088 else
00089 {
00090 if (k_ != 0)
00091 {
00092 search_parameter_ = k_;
00093 if (surface_ == input_)
00094 {
00095
00096 int (KdTree::*nearestKSearch)(int index, int k, std::vector<int> &k_indices, std::vector<float> &k_distances) = &KdTree::nearestKSearch;
00097 search_method_ = boost::bind (nearestKSearch, boost::ref (tree_), _1, _2, _3, _4);
00098 }
00099 else
00100 {
00101
00102 int (KdTree::*nearestKSearchSurface)(const PointCloudIn &cloud, int index, int k, std::vector<int> &k_indices, std::vector<float> &k_distances) = &KdTree::nearestKSearch;
00103 search_method_surface_ = boost::bind (nearestKSearchSurface, boost::ref (tree_), _1, _2, _3, _4, _5);
00104 }
00105 }
00106 else
00107 {
00108 ROS_ERROR ("[pcl::%s::compute] Neither radius nor K defined! Set one of them to a positive number first and then re-run compute ().", getClassName ().c_str ());
00109 return;
00110 }
00111 }
00112
00113
00114 detectKeypoints(output);
00115
00116 deinitCompute ();
00117
00118
00119 if (input_ == surface_)
00120 surface_.reset ();
00121 }