38 #ifndef PCL_VISUALUALIZATION_PCL_PLOTTER_IMPL_H_
39 #define PCL_VISUALUALIZATION_PCL_PLOTTER_IMPL_H_
45 namespace visualization
48 template <
typename Po
intT>
bool
51 const std::string &
id,
int win_width,
int win_height)
53 std::vector<double> array_x(hsize), array_y(hsize);
56 for (
int i = 0; i < hsize; ++i)
59 array_y[i] = cloud[0].histogram[i];
62 this->
addPlotData(array_x, array_y,
id.c_str(), vtkChart::LINE);
68 template <
typename Po
intT>
bool
71 const std::string &field_name,
73 const std::string &
id,
int win_width,
int win_height)
75 if (index < 0 || index >= cloud.
size ())
77 PCL_ERROR (
"[addFeatureHistogram] Invalid point index (%d) given!\n", index);
82 std::vector<pcl::PCLPointField> fields;
84 int field_idx = pcl::getFieldIndex<PointT> (cloud, field_name, fields);
87 PCL_ERROR (
"[addFeatureHistogram] The specified field <%s> does not exist!\n", field_name.c_str ());
91 int hsize = fields[field_idx].count;
92 std::vector<double> array_x (hsize), array_y (hsize);
94 for (
int i = 0; i < hsize; ++i)
99 memcpy (&data,
reinterpret_cast<const char*
> (&cloud[index]) + fields[field_idx].offset + i *
sizeof (
float),
sizeof (
float));
103 this->
addPlotData(array_x, array_y,
id.c_str(), vtkChart::LINE);
PointCloud represents the base class in PCL for storing collections of 3D points.
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=nullptr)
Adds a plot with correspondences in the arrays arrayX and arrayY.
void setWindowSize(int w, int h)
set/get method for the window size.
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.
detail::int_type_t< detail::index_type_size, detail::index_type_signed > index_t
Type used for an index in PCL.