Go to the documentation of this file.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
00037
00038 #ifndef PCL_PYRAMID_FEATURE_MATCHING_H_
00039 #define PCL_PYRAMID_FEATURE_MATCHING_H_
00040
00041 #include <pcl/pcl_base.h>
00042 #include <pcl/point_representation.h>
00043
00044 namespace pcl
00045 {
00064 template <typename PointFeature>
00065 class PyramidFeatureHistogram : public PCLBase<PointFeature>
00066 {
00067 public:
00068 using PCLBase<PointFeature>::input_;
00069
00070 typedef boost::shared_ptr<PyramidFeatureHistogram<PointFeature> > Ptr;
00071 typedef Ptr PyramidFeatureHistogramPtr;
00072 typedef boost::shared_ptr<const pcl::PointRepresentation<PointFeature> > FeatureRepresentationConstPtr;
00073
00074
00076 PyramidFeatureHistogram ();
00077
00081 inline void
00082 setInputDimensionRange (std::vector<std::pair<float, float> > &dimension_range_input)
00083 { dimension_range_input_ = dimension_range_input; }
00084
00086 inline std::vector<std::pair<float, float> >
00087 getInputDimensionRange () { return dimension_range_input_; }
00088
00092 inline void
00093 setTargetDimensionRange (std::vector<std::pair<float, float> > &dimension_range_target)
00094 { dimension_range_target_ = dimension_range_target; }
00095
00097 inline std::vector<std::pair<float, float> >
00098 getTargetDimensionRange () { return dimension_range_target_; }
00099
00103 inline void
00104 setPointRepresentation (const FeatureRepresentationConstPtr& feature_representation) { feature_representation_ = feature_representation; }
00105
00107 inline FeatureRepresentationConstPtr const
00108 getPointRepresentation () { return feature_representation_; }
00109
00111 void
00112 compute ();
00113
00115 inline bool
00116 isComputed () { return is_computed_; }
00117
00123 static float
00124 comparePyramidFeatureHistograms (const PyramidFeatureHistogramPtr &pyramid_a,
00125 const PyramidFeatureHistogramPtr &pyramid_b);
00126
00127
00128 private:
00129 size_t nr_dimensions, nr_levels, nr_features;
00130 std::vector<std::pair<float, float> > dimension_range_input_, dimension_range_target_;
00131 FeatureRepresentationConstPtr feature_representation_;
00132 bool is_computed_;
00133
00135 bool
00136 initializeHistogram ();
00137
00141 void
00142 convertFeatureToVector (const PointFeature &feature,
00143 std::vector<float> &feature_vector);
00144
00146 void
00147 addFeature (std::vector<float> &feature);
00148
00154 inline unsigned int&
00155 at (std::vector<size_t> &access,
00156 size_t &level);
00157
00162 inline unsigned int&
00163 at (std::vector<float> &feature,
00164 size_t &level);
00165
00167 struct PyramidFeatureHistogramLevel
00168 {
00169 PyramidFeatureHistogramLevel () :
00170 hist (),
00171 bins_per_dimension (),
00172 bin_step ()
00173 {
00174 }
00175
00176 PyramidFeatureHistogramLevel (std::vector<size_t> &a_bins_per_dimension, std::vector<float> &a_bin_step) :
00177 hist (),
00178 bins_per_dimension (a_bins_per_dimension),
00179 bin_step (a_bin_step)
00180 {
00181 initializeHistogramLevel ();
00182 }
00183
00184 void
00185 initializeHistogramLevel ();
00186
00187 std::vector<unsigned int> hist;
00188 std::vector<size_t> bins_per_dimension;
00189 std::vector<float> bin_step;
00190 };
00191 std::vector<PyramidFeatureHistogramLevel> hist_levels;
00192 };
00193 }
00194
00195 #endif