38 #ifndef PCL_VISUALUALIZATION_PCL_PLOTTER_IMPL_H_
39 #define PCL_VISUALUALIZATION_PCL_PLOTTER_IMPL_H_
41 template <
typename Po
intT>
bool
44 const std::string &
id,
int win_width,
int win_height)
46 std::vector<double> array_x(hsize), array_y(hsize);
49 for (
int i = 0; i < hsize; ++i)
52 array_y[i] = cloud.
points[0].histogram[i];
55 this->
addPlotData(array_x, array_y,
id.c_str(), vtkChart::LINE);
61 template <
typename Po
intT>
bool
64 const std::string &field_name,
66 const std::string &
id,
int win_width,
int win_height)
68 if (index < 0 || index >= cloud.
points.size ())
70 PCL_ERROR (
"[addFeatureHistogram] Invalid point index (%d) given!\n", index);
75 std::vector<pcl::PCLPointField> fields;
77 int field_idx = pcl::getFieldIndex<PointT> (cloud, field_name, fields);
80 PCL_ERROR (
"[addFeatureHistogram] The specified field <%s> does not exist!\n", field_name.c_str ());
84 int hsize = fields[field_idx].count;
85 std::vector<double> array_x (hsize), array_y (hsize);
87 for (
int i = 0; i < hsize; ++i)
92 memcpy (&data, reinterpret_cast<const char*> (&cloud.points[index]) + fields[field_idx].offset + i * sizeof (
float),
sizeof (
float));
96 this->addPlotData(array_x, array_y,
id.c_str(), vtkChart::LINE);
97 setWindowSize (win_width, win_height);
void setWindowSize(int w, int h)
set/get method for the window size.
void addPlotData(double const *array_X, double const *array_Y, unsigned long size, char const *name="Y Axis", int type=vtkChart::LINE, char const *color=NULL)
Adds a plot with correspondences in the arrays arrayX and arrayY.
std::vector< PointT, Eigen::aligned_allocator< PointT > > points
The point data.
bool addFeatureHistogram(const pcl::PointCloud< PointT > &cloud, int hsize, const std::string &id="cloud", int win_width=640, int win_height=200)
Add a histogram feature to screen as a separate window, from a cloud containing a single histogram...
PointCloud represents the base class in PCL for storing collections of 3D points. ...