Point Cloud Library (PCL)  1.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
esf.hpp
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010-2012, Willow Garage, Inc.
6  * Copyright (c) 2012-, Open Perception, Inc.
7  *
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
14  * * Redistributions of source code must retain the above copyright
15  * notice, this list of conditions and the following disclaimer.
16  * * Redistributions in binary form must reproduce the above
17  * copyright notice, this list of conditions and the following
18  * disclaimer in the documentation and/or other materials provided
19  * with the distribution.
20  * * Neither the name of the copyright holder(s) nor the names of its
21  * contributors may be used to endorse or promote products derived
22  * from this software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35  * POSSIBILITY OF SUCH DAMAGE.
36  *
37  * $Id: pfh.hpp 5027 2012-03-12 03:10:45Z rusu $
38  *
39  */
40 
41 #ifndef PCL_FEATURES_IMPL_ESF_H_
42 #define PCL_FEATURES_IMPL_ESF_H_
43 
44 #include <pcl/features/esf.h>
45 #include <pcl/common/common.h>
46 #include <pcl/common/transforms.h>
47 #include <vector>
48 
50 template <typename PointInT, typename PointOutT> void
52  PointCloudIn &pc, std::vector<float> &hist)
53 {
54  const int binsize = 64;
55  unsigned int sample_size = 20000;
56  srand (static_cast<unsigned int> (time (0)));
57  int maxindex = static_cast<int> (pc.points.size ());
58 
59  int index1, index2, index3;
60  std::vector<float> d2v, d1v, d3v, wt_d3;
61  std::vector<int> wt_d2;
62  d1v.reserve (sample_size);
63  d2v.reserve (sample_size * 3);
64  d3v.reserve (sample_size);
65  wt_d2.reserve (sample_size * 3);
66  wt_d3.reserve (sample_size);
67 
68  float h_in[binsize] = {0};
69  float h_out[binsize] = {0};
70  float h_mix[binsize] = {0};
71  float h_mix_ratio[binsize] = {0};
72 
73  float h_a3_in[binsize] = {0};
74  float h_a3_out[binsize] = {0};
75  float h_a3_mix[binsize] = {0};
76  float h_d1[binsize] = {0};
77 
78  float h_d3_in[binsize] = {0};
79  float h_d3_out[binsize] = {0};
80  float h_d3_mix[binsize] = {0};
81 
82  float ratio=0.0;
83  float pih = static_cast<float>(M_PI) / 2.0f;
84  float a,b,c,s;
85  int th1,th2,th3;
86  int vxlcnt = 0;
87  int pcnt1,pcnt2,pcnt3;
88  for (size_t nn_idx = 0; nn_idx < sample_size; ++nn_idx)
89  {
90  // get a new random point
91  index1 = rand()%maxindex;
92  index2 = rand()%maxindex;
93  index3 = rand()%maxindex;
94 
95  if (index1==index2 || index1 == index3 || index2 == index3)
96  {
97  nn_idx--;
98  continue;
99  }
100 
101  Eigen::Vector4f p1 = pc.points[index1].getVector4fMap ();
102  Eigen::Vector4f p2 = pc.points[index2].getVector4fMap ();
103  Eigen::Vector4f p3 = pc.points[index3].getVector4fMap ();
104 
105  // A3
106  Eigen::Vector4f v21 (p2 - p1);
107  Eigen::Vector4f v31 (p3 - p1);
108  Eigen::Vector4f v23 (p2 - p3);
109  a = v21.norm (); b = v31.norm (); c = v23.norm (); s = (a+b+c) * 0.5f;
110  if (s * (s-a) * (s-b) * (s-c) <= 0.001f)
111  continue;
112 
113  v21.normalize ();
114  v31.normalize ();
115  v23.normalize ();
116 
117  //TODO: .dot gives nan's
118  th1 = static_cast<int> (pcl_round (acos (fabs (v21.dot (v31))) / pih * (binsize-1)));
119  th2 = static_cast<int> (pcl_round (acos (fabs (v23.dot (v31))) / pih * (binsize-1)));
120  th3 = static_cast<int> (pcl_round (acos (fabs (v23.dot (v21))) / pih * (binsize-1)));
121  if (th1 < 0 || th1 >= binsize)
122  {
123  nn_idx--;
124  continue;
125  }
126  if (th2 < 0 || th2 >= binsize)
127  {
128  nn_idx--;
129  continue;
130  }
131  if (th3 < 0 || th3 >= binsize)
132  {
133  nn_idx--;
134  continue;
135  }
136 
137  //pcl::PointXYZ cog(((rand()%100)-50.0f) / 100.0f,((rand()%100)-50.0f) / 100.0f,((rand()%100)-50.0f) / 100.0f);
138  // D1
139  // d1v.push_back( pcl::euclideanDistance(cog, pc.points[index1]) );
140 
141  // D2
142  d2v.push_back (pcl::euclideanDistance (pc.points[index1], pc.points[index2]));
143  d2v.push_back (pcl::euclideanDistance (pc.points[index1], pc.points[index3]));
144  d2v.push_back (pcl::euclideanDistance (pc.points[index2], pc.points[index3]));
145 
146  int vxlcnt_sum = 0;
147  int p_cnt = 0;
148  // IN, OUT, MIXED, Ratio line tracing, index1->index2
149  {
150  const int xs = p1[0] < 0.0? static_cast<int>(floor(p1[0])+GRIDSIZE_H): static_cast<int>(ceil(p1[0])+GRIDSIZE_H-1);
151  const int ys = p1[1] < 0.0? static_cast<int>(floor(p1[1])+GRIDSIZE_H): static_cast<int>(ceil(p1[1])+GRIDSIZE_H-1);
152  const int zs = p1[2] < 0.0? static_cast<int>(floor(p1[2])+GRIDSIZE_H): static_cast<int>(ceil(p1[2])+GRIDSIZE_H-1);
153  const int xt = p2[0] < 0.0? static_cast<int>(floor(p2[0])+GRIDSIZE_H): static_cast<int>(ceil(p2[0])+GRIDSIZE_H-1);
154  const int yt = p2[1] < 0.0? static_cast<int>(floor(p2[1])+GRIDSIZE_H): static_cast<int>(ceil(p2[1])+GRIDSIZE_H-1);
155  const int zt = p2[2] < 0.0? static_cast<int>(floor(p2[2])+GRIDSIZE_H): static_cast<int>(ceil(p2[2])+GRIDSIZE_H-1);
156  wt_d2.push_back (this->lci (xs, ys, zs, xt, yt, zt, ratio, vxlcnt, pcnt1));
157  if (wt_d2.back () == 2)
158  h_mix_ratio[static_cast<int> (pcl_round (ratio * (binsize-1)))]++;
159  vxlcnt_sum += vxlcnt;
160  p_cnt += pcnt1;
161  }
162  // IN, OUT, MIXED, Ratio line tracing, index1->index3
163  {
164  const int xs = p1[0] < 0.0? static_cast<int>(floor(p1[0])+GRIDSIZE_H): static_cast<int>(ceil(p1[0])+GRIDSIZE_H-1);
165  const int ys = p1[1] < 0.0? static_cast<int>(floor(p1[1])+GRIDSIZE_H): static_cast<int>(ceil(p1[1])+GRIDSIZE_H-1);
166  const int zs = p1[2] < 0.0? static_cast<int>(floor(p1[2])+GRIDSIZE_H): static_cast<int>(ceil(p1[2])+GRIDSIZE_H-1);
167  const int xt = p3[0] < 0.0? static_cast<int>(floor(p3[0])+GRIDSIZE_H): static_cast<int>(ceil(p3[0])+GRIDSIZE_H-1);
168  const int yt = p3[1] < 0.0? static_cast<int>(floor(p3[1])+GRIDSIZE_H): static_cast<int>(ceil(p3[1])+GRIDSIZE_H-1);
169  const int zt = p3[2] < 0.0? static_cast<int>(floor(p3[2])+GRIDSIZE_H): static_cast<int>(ceil(p3[2])+GRIDSIZE_H-1);
170  wt_d2.push_back (this->lci (xs, ys, zs, xt, yt, zt, ratio, vxlcnt, pcnt2));
171  if (wt_d2.back () == 2)
172  h_mix_ratio[static_cast<int>(pcl_round (ratio * (binsize-1)))]++;
173  vxlcnt_sum += vxlcnt;
174  p_cnt += pcnt2;
175  }
176  // IN, OUT, MIXED, Ratio line tracing, index2->index3
177  {
178  const int xs = p2[0] < 0.0? static_cast<int>(floor(p2[0])+GRIDSIZE_H): static_cast<int>(ceil(p2[0])+GRIDSIZE_H-1);
179  const int ys = p2[1] < 0.0? static_cast<int>(floor(p2[1])+GRIDSIZE_H): static_cast<int>(ceil(p2[1])+GRIDSIZE_H-1);
180  const int zs = p2[2] < 0.0? static_cast<int>(floor(p2[2])+GRIDSIZE_H): static_cast<int>(ceil(p2[2])+GRIDSIZE_H-1);
181  const int xt = p3[0] < 0.0? static_cast<int>(floor(p3[0])+GRIDSIZE_H): static_cast<int>(ceil(p3[0])+GRIDSIZE_H-1);
182  const int yt = p3[1] < 0.0? static_cast<int>(floor(p3[1])+GRIDSIZE_H): static_cast<int>(ceil(p3[1])+GRIDSIZE_H-1);
183  const int zt = p3[2] < 0.0? static_cast<int>(floor(p3[2])+GRIDSIZE_H): static_cast<int>(ceil(p3[2])+GRIDSIZE_H-1);
184  wt_d2.push_back (this->lci (xs,ys,zs,xt,yt,zt,ratio,vxlcnt,pcnt3));
185  if (wt_d2.back () == 2)
186  h_mix_ratio[static_cast<int>(pcl_round(ratio * (binsize-1)))]++;
187  vxlcnt_sum += vxlcnt;
188  p_cnt += pcnt3;
189  }
190 
191  // D3 ( herons formula )
192  d3v.push_back (sqrt (sqrt (s * (s-a) * (s-b) * (s-c))));
193  if (vxlcnt_sum <= 21)
194  {
195  wt_d3.push_back (0);
196  h_a3_out[th1] += static_cast<float> (pcnt3) / 32.0f;
197  h_a3_out[th2] += static_cast<float> (pcnt1) / 32.0f;
198  h_a3_out[th3] += static_cast<float> (pcnt2) / 32.0f;
199  }
200  else
201  if (p_cnt - vxlcnt_sum < 4)
202  {
203  h_a3_in[th1] += static_cast<float> (pcnt3) / 32.0f;
204  h_a3_in[th2] += static_cast<float> (pcnt1) / 32.0f;
205  h_a3_in[th3] += static_cast<float> (pcnt2) / 32.0f;
206  wt_d3.push_back (1);
207  }
208  else
209  {
210  h_a3_mix[th1] += static_cast<float> (pcnt3) / 32.0f;
211  h_a3_mix[th2] += static_cast<float> (pcnt1) / 32.0f;
212  h_a3_mix[th3] += static_cast<float> (pcnt2) / 32.0f;
213  wt_d3.push_back (static_cast<float> (vxlcnt_sum) / static_cast<float> (p_cnt));
214  }
215  }
216  // Normalizing, get max
217  float maxd1 = 0;
218  float maxd2 = 0;
219  float maxd3 = 0;
220 
221  for (size_t nn_idx = 0; nn_idx < sample_size; ++nn_idx)
222  {
223  // get max of Dx
224  if (d1v[nn_idx] > maxd1)
225  maxd1 = d1v[nn_idx];
226  if (d2v[nn_idx] > maxd2)
227  maxd2 = d2v[nn_idx];
228  if (d2v[sample_size + nn_idx] > maxd2)
229  maxd2 = d2v[sample_size + nn_idx];
230  if (d2v[sample_size*2 +nn_idx] > maxd2)
231  maxd2 = d2v[sample_size*2 +nn_idx];
232  if (d3v[nn_idx] > maxd3)
233  maxd3 = d3v[nn_idx];
234  }
235 
236  // Normalize and create histogram
237  int index;
238  for (size_t nn_idx = 0; nn_idx < sample_size; ++nn_idx)
239  {
240  h_d1[static_cast<int>(pcl_round (d1v[nn_idx] / maxd1 * (binsize-1)))]++ ;
241 
242  if (wt_d3[nn_idx] >= 0.999) // IN
243  {
244  index = static_cast<int>(pcl_round (d3v[nn_idx] / maxd3 * (binsize-1)));
245  if (index >= 0 && index < binsize)
246  h_d3_in[index]++;
247  }
248  else
249  {
250  if (wt_d3[nn_idx] <= 0.001) // OUT
251  {
252  index = static_cast<int>(pcl_round (d3v[nn_idx] / maxd3 * (binsize-1)));
253  if (index >= 0 && index < binsize)
254  h_d3_out[index]++ ;
255  }
256  else
257  {
258  index = static_cast<int>(pcl_round (d3v[nn_idx] / maxd3 * (binsize-1)));
259  if (index >= 0 && index < binsize)
260  h_d3_mix[index]++;
261  }
262  }
263  }
264  //normalize and create histogram
265  for (size_t nn_idx = 0; nn_idx < d2v.size(); ++nn_idx )
266  {
267  if (wt_d2[nn_idx] == 0)
268  h_in[static_cast<int>(pcl_round (d2v[nn_idx] / maxd2 * (binsize-1)))]++ ;
269  if (wt_d2[nn_idx] == 1)
270  h_out[static_cast<int>(pcl_round (d2v[nn_idx] / maxd2 * (binsize-1)))]++;
271  if (wt_d2[nn_idx] == 2)
272  h_mix[static_cast<int>(pcl_round (d2v[nn_idx] / maxd2 * (binsize-1)))]++ ;
273  }
274 
275  //float weights[10] = {1, 1, 1, 1, 1, 1, 1, 1 , 1 , 1};
276  float weights[10] = {0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f};
277 
278  hist.reserve (binsize * 10);
279  for (int i = 0; i < binsize; i++)
280  hist.push_back (h_a3_in[i] * weights[0]);
281  for (int i = 0; i < binsize; i++)
282  hist.push_back (h_a3_out[i] * weights[1]);
283  for (int i = 0; i < binsize; i++)
284  hist.push_back (h_a3_mix[i] * weights[2]);
285 
286  for (int i = 0; i < binsize; i++)
287  hist.push_back (h_d3_in[i] * weights[3]);
288  for (int i = 0; i < binsize; i++)
289  hist.push_back (h_d3_out[i] * weights[4]);
290  for (int i = 0; i < binsize; i++)
291  hist.push_back (h_d3_mix[i] * weights[5]);
292 
293  for (int i = 0; i < binsize; i++)
294  hist.push_back (h_in[i]*0.5f * weights[6]);
295  for (int i = 0; i < binsize; i++)
296  hist.push_back (h_out[i] * weights[7]);
297  for (int i = 0; i < binsize; i++)
298  hist.push_back (h_mix[i] * weights[8]);
299  for (int i = 0; i < binsize; i++)
300  hist.push_back (h_mix_ratio[i]*0.5f * weights[9]);
301 
302  float sm = 0;
303  for (size_t i = 0; i < hist.size (); i++)
304  sm += hist[i];
305 
306  for (size_t i = 0; i < hist.size (); i++)
307  hist[i] /= sm;
308 }
309 
311 template <typename PointInT, typename PointOutT> int
313  const int x1, const int y1, const int z1,
314  const int x2, const int y2, const int z2,
315  float &ratio, int &incnt, int &pointcount)
316 {
317  int voxelcount = 0;
318  int voxel_in = 0;
319  int act_voxel[3];
320  act_voxel[0] = x1;
321  act_voxel[1] = y1;
322  act_voxel[2] = z1;
323  int x_inc, y_inc, z_inc;
324  int dx = x2 - x1;
325  int dy = y2 - y1;
326  int dz = z2 - z1;
327  if (dx < 0)
328  x_inc = -1;
329  else
330  x_inc = 1;
331  int l = abs (dx);
332  if (dy < 0)
333  y_inc = -1 ;
334  else
335  y_inc = 1;
336  int m = abs (dy);
337  if (dz < 0)
338  z_inc = -1 ;
339  else
340  z_inc = 1;
341  int n = abs (dz);
342  int dx2 = 2 * l;
343  int dy2 = 2 * m;
344  int dz2 = 2 * n;
345  if ((l >= m) & (l >= n))
346  {
347  int err_1 = dy2 - l;
348  int err_2 = dz2 - l;
349  for (int i = 1; i<l; i++)
350  {
351  voxelcount++;;
352  voxel_in += static_cast<int>(lut_[act_voxel[0]][act_voxel[1]][act_voxel[2]] == 1);
353  if (err_1 > 0)
354  {
355  act_voxel[1] += y_inc;
356  err_1 -= dx2;
357  }
358  if (err_2 > 0)
359  {
360  act_voxel[2] += z_inc;
361  err_2 -= dx2;
362  }
363  err_1 += dy2;
364  err_2 += dz2;
365  act_voxel[0] += x_inc;
366  }
367  }
368  else if ((m >= l) & (m >= n))
369  {
370  int err_1 = dx2 - m;
371  int err_2 = dz2 - m;
372  for (int i=1; i<m; i++)
373  {
374  voxelcount++;
375  voxel_in += static_cast<int>(lut_[act_voxel[0]][act_voxel[1]][act_voxel[2]] == 1);
376  if (err_1 > 0)
377  {
378  act_voxel[0] += x_inc;
379  err_1 -= dy2;
380  }
381  if (err_2 > 0)
382  {
383  act_voxel[2] += z_inc;
384  err_2 -= dy2;
385  }
386  err_1 += dx2;
387  err_2 += dz2;
388  act_voxel[1] += y_inc;
389  }
390  }
391  else
392  {
393  int err_1 = dy2 - n;
394  int err_2 = dx2 - n;
395  for (int i=1; i<n; i++)
396  {
397  voxelcount++;
398  voxel_in += static_cast<int>(lut_[act_voxel[0]][act_voxel[1]][act_voxel[2]] == 1);
399  if (err_1 > 0)
400  {
401  act_voxel[1] += y_inc;
402  err_1 -= dz2;
403  }
404  if (err_2 > 0)
405  {
406  act_voxel[0] += x_inc;
407  err_2 -= dz2;
408  }
409  err_1 += dy2;
410  err_2 += dx2;
411  act_voxel[2] += z_inc;
412  }
413  }
414  voxelcount++;
415  voxel_in += static_cast<int>(lut_[act_voxel[0]][act_voxel[1]][act_voxel[2]] == 1);
416  incnt = voxel_in;
417  pointcount = voxelcount;
418 
419  if (voxel_in >= voxelcount-1)
420  return (0);
421 
422  if (voxel_in <= 7)
423  return (1);
424 
425  ratio = static_cast<float>(voxel_in) / static_cast<float>(voxelcount);
426  return (2);
427 }
428 
430 template <typename PointInT, typename PointOutT> void
432 {
433  int xi,yi,zi,xx,yy,zz;
434  for (size_t i = 0; i < cluster.points.size (); ++i)
435  {
436  xx = cluster.points[i].x<0.0? static_cast<int>(floor(cluster.points[i].x)+GRIDSIZE_H) : static_cast<int>(ceil(cluster.points[i].x)+GRIDSIZE_H-1);
437  yy = cluster.points[i].y<0.0? static_cast<int>(floor(cluster.points[i].y)+GRIDSIZE_H) : static_cast<int>(ceil(cluster.points[i].y)+GRIDSIZE_H-1);
438  zz = cluster.points[i].z<0.0? static_cast<int>(floor(cluster.points[i].z)+GRIDSIZE_H) : static_cast<int>(ceil(cluster.points[i].z)+GRIDSIZE_H-1);
439 
440  for (int x = -1; x < 2; x++)
441  for (int y = -1; y < 2; y++)
442  for (int z = -1; z < 2; z++)
443  {
444  xi = xx + x;
445  yi = yy + y;
446  zi = zz + z;
447 
448  if (yi >= GRIDSIZE || xi >= GRIDSIZE || zi>=GRIDSIZE || yi < 0 || xi < 0 || zi < 0)
449  {
450  ;
451  }
452  else
453  this->lut_[xi][yi][zi] = 1;
454  }
455  }
456 }
457 
459 template <typename PointInT, typename PointOutT> void
461 {
462  int xi,yi,zi,xx,yy,zz;
463  for (size_t i = 0; i < cluster.points.size (); ++i)
464  {
465  xx = cluster.points[i].x<0.0? static_cast<int>(floor(cluster.points[i].x)+GRIDSIZE_H) : static_cast<int>(ceil(cluster.points[i].x)+GRIDSIZE_H-1);
466  yy = cluster.points[i].y<0.0? static_cast<int>(floor(cluster.points[i].y)+GRIDSIZE_H) : static_cast<int>(ceil(cluster.points[i].y)+GRIDSIZE_H-1);
467  zz = cluster.points[i].z<0.0? static_cast<int>(floor(cluster.points[i].z)+GRIDSIZE_H) : static_cast<int>(ceil(cluster.points[i].z)+GRIDSIZE_H-1);
468 
469  for (int x = -1; x < 2; x++)
470  for (int y = -1; y < 2; y++)
471  for (int z = -1; z < 2; z++)
472  {
473  xi = xx + x;
474  yi = yy + y;
475  zi = zz + z;
476 
477  if (yi >= GRIDSIZE || xi >= GRIDSIZE || zi>=GRIDSIZE || yi < 0 || xi < 0 || zi < 0)
478  {
479  ;
480  }
481  else
482  this->lut_[xi][yi][zi] = 0;
483  }
484  }
485 }
486 
488 template <typename PointInT, typename PointOutT> void
490  const pcl::PointCloud<PointInT> &pc, float scalefactor, Eigen::Vector4f& centroid)
491 {
492  pcl::compute3DCentroid (pc, centroid);
493  pcl::demeanPointCloud (pc, centroid, local_cloud_);
494 
495  float max_distance = 0, d;
496  pcl::PointXYZ cog (0, 0, 0);
497 
498  for (size_t i = 0; i < local_cloud_.points.size (); ++i)
499  {
500  d = pcl::euclideanDistance(cog,local_cloud_.points[i]);
501  if (d > max_distance)
502  max_distance = d;
503  }
504 
505  float scale_factor = 1.0f / max_distance * scalefactor;
506 
507  Eigen::Affine3f matrix = Eigen::Affine3f::Identity();
508  matrix.scale (scale_factor);
509  pcl::transformPointCloud (local_cloud_, local_cloud_, matrix);
510 }
511 
513 template<typename PointInT, typename PointOutT> void
515 {
517  {
518  output.width = output.height = 0;
519  output.points.clear ();
520  return;
521  }
522  // Copy the header
523  output.header = input_->header;
524 
525  // Resize the output dataset
526  // Important! We should only allocate precisely how many elements we will need, otherwise
527  // we risk at pre-allocating too much memory which could lead to bad_alloc
528  // (see http://dev.pointclouds.org/issues/657)
529  output.width = output.height = 1;
530  output.is_dense = input_->is_dense;
531  output.points.resize (1);
532 
533  // Perform the actual feature computation
534  computeFeature (output);
535 
537 }
538 
539 
541 template <typename PointInT, typename PointOutT> void
543 {
544  Eigen::Vector4f xyz_centroid;
545  std::vector<float> hist;
546  scale_points_unit_sphere (*surface_, static_cast<float>(GRIDSIZE_H), xyz_centroid);
547  this->voxelize9 (local_cloud_);
548  this->computeESF (local_cloud_, hist);
549  this->cleanup9 (local_cloud_);
550 
551  // We only output _1_ signature
552  output.points.resize (1);
553  output.width = 1;
554  output.height = 1;
555 
556  for (size_t d = 0; d < hist.size (); ++d)
557  output.points[0].histogram[d] = hist[d];
558 }
559 
560 #define PCL_INSTANTIATE_ESFEstimation(T,OutT) template class PCL_EXPORTS pcl::ESFEstimation<T,OutT>;
561 
562 #endif // PCL_FEATURES_IMPL_ESF_H_
563