feature_generator.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef FEATURE_GENERATOR_H
  2. #define FEATURE_GENERATOR_H
  3. #include "caffe/caffe.hpp"
  4. #include <pcl/point_types.h>
  5. #include <pcl/point_cloud.h>
  6. //#include <pcl_ros/point_cloud.h>
  7. #include "util.h"
  8. class FeatureGenerator
  9. {
  10. public:
  11. FeatureGenerator(){}
  12. ~FeatureGenerator(){}
  13. bool init(caffe::Blob<float>* out_blob, bool use_constant_feature);
  14. void generate(
  15. const pcl::PointCloud<pcl::PointXYZI>::Ptr& pc_ptr);
  16. private:
  17. int width_ = 0;
  18. int height_ = 0;
  19. int range_ = 0;
  20. float min_height_ = 0.0;
  21. float max_height_ = 0.0;
  22. // raw feature data
  23. float* max_height_data_ = nullptr;
  24. float* mean_height_data_ = nullptr;
  25. float* count_data_ = nullptr;
  26. float* direction_data_ = nullptr;
  27. float* top_intensity_data_ = nullptr;
  28. float* mean_intensity_data_ = nullptr;
  29. float* distance_data_ = nullptr;
  30. float* nonempty_data_ = nullptr;
  31. // output Caffe blob
  32. caffe::Blob<float>* out_blob_ = nullptr;
  33. std::vector<float> log_table_;
  34. // point index in feature map
  35. std::vector<int> map_idx_;
  36. float logCount(int count);
  37. };
  38. #endif //FEATURE_GENERATOR_H