24 namespace perception {
40 int stat_len = xstep + ystep + zstep;
41 std::vector<int> stat_feat(stat_len, 0);
43 (max_pt_.
x - min_pt_.
x) / static_cast<float>(xstep) + 0.000001f;
45 (max_pt_.
y - min_pt_.
y) / static_cast<float>(ystep) + 0.000001f;
47 (max_pt_.
z - min_pt_.
z) / static_cast<float>(zstep) + 0.000001f;
49 int pt_num =
static_cast<int>(cloud_->
size());
50 for (
int i = 0; i < pt_num; ++i) {
52 ++stat_feat[
static_cast<int>((pt.
x - min_pt_.
x) / xsize)];
53 ++stat_feat[xstep +
static_cast<int>((pt.
y - min_pt_.
y) / ysize)];
54 ++stat_feat[xstep + ystep +
static_cast<int>((pt.
z - min_pt_.
z) / zsize)];
57 feature[0] = center_pt_.
x / 10.0f;
58 feature[1] = center_pt_.
y / 10.0f;
59 feature[2] = center_pt_.
z;
63 feature[6] =
static_cast<float>(pt_num);
64 for (
size_t i = 0; i < stat_feat.size(); ++i) {
66 static_cast<float>(stat_feat[i]) / static_cast<float>(pt_num);
71 void GetMinMaxCenter() {
75 min_pt_.
x = min_pt_.
y = min_pt_.
z = FLT_MAX;
76 max_pt_.
x = max_pt_.
y = max_pt_.
z = -FLT_MAX;
78 float pt_num =
static_cast<float>(cloud_->
size());
79 for (
int i = 0; i < static_cast<int>(pt_num); ++i) {
84 min_pt_.
x = std::min(min_pt_.
x, pt.
x);
85 max_pt_.
x = std::max(max_pt_.
x, pt.
x);
86 min_pt_.
y = std::min(min_pt_.
y, pt.
y);
87 max_pt_.
y = std::max(max_pt_.
y, pt.
y);
88 min_pt_.
z = std::min(min_pt_.
z, pt.
z);
89 max_pt_.
z = std::max(max_pt_.
z, pt.
z);
93 center_pt_.
x = xsum / pt_num;
94 center_pt_.
y = ysum / pt_num;
95 center_pt_.
z = zsum / pt_num;
~FeatureDescriptor()=default
T x
Definition: point.h:30
size_t size() const
Definition: point_cloud.h:76
T z
Definition: point.h:32
Definition: point_cloud.h:257
void ComputeHistogram(int bin_size, float *feature)
Definition: feature_descriptor.h:35
FeatureDescriptor(base::PointFCloud *cloud)
Definition: feature_descriptor.h:29
void SetCloud(base::PointFCloud *cloud)
Definition: feature_descriptor.h:33
Definition: feature_descriptor.h:27
FeatureDescriptor()
Definition: feature_descriptor.h:30
T y
Definition: point.h:31
const PointT * at(size_t col, size_t row) const
Definition: point_cloud.h:57