Point Cloud Library (PCL)
1.11.1
|
46 #include <pcl/visualization/common/common.h>
48 #include <pcl/correspondence.h>
49 #include <pcl/point_cloud.h>
50 #include <pcl/common/io.h>
52 class vtkRenderWindow;
53 class vtkRenderWindowInteractor;
58 #include <vtkSmartPointer.h>
59 #include <vtkCommand.h>
64 namespace visualization
79 using Ptr = shared_ptr<PCLPlotter>;
108 double const *array_Y,
110 char const * name =
"Y Axis",
111 int type = vtkChart::LINE ,
112 char const *color=
nullptr);
123 std::vector<double>
const &array_y,
124 char const * name =
"Y Axis",
125 int type = vtkChart::LINE,
126 std::vector<char>
const &color = std::vector<char> ());
135 addPlotData (std::vector<std::pair<double, double> >
const &plot_data,
136 char const * name =
"Y Axis",
137 int type = vtkChart::LINE,
138 std::vector<char>
const &color = std::vector<char>());
151 double x_min,
double x_max,
152 char const *name =
"Y Axis",
153 int num_points = 100,
154 int type = vtkChart::LINE,
155 std::vector<char>
const &color = std::vector<char>());
168 double x_min,
double x_max,
169 char const *name =
"Y Axis",
170 int num_points = 100,
171 int type = vtkChart::LINE,
172 std::vector<char>
const &color = std::vector<char>());
185 double x_min,
double x_max,
186 char const *name =
"Y Axis",
187 int num_points = 100,
188 int type = vtkChart::LINE,
189 std::vector<char>
const &color = std::vector<char>());
197 int type = vtkChart::LINE);
207 int const nbins = 10,
208 char const * name =
"Histogram",
209 std::vector<char>
const &color = std::vector<char>());
219 template <
typename Po
intT>
bool
222 const std::string &
id =
"cloud",
int win_width = 640,
int win_height = 200);
233 const std::string &field_name,
234 const std::string &
id =
"cloud",
int win_width = 640,
int win_height = 200);
244 template <
typename Po
intT>
bool
246 const std::string &field_name,
248 const std::string &
id =
"cloud",
int win_width = 640,
int win_height = 200);
260 const std::string &field_name,
262 const std::string &
id =
"cloud",
int win_width = 640,
int win_height = 200);
408 int win_width_, win_height_;
410 double bkg_color_[3];
411 std::string win_name_;
414 struct ExitMainLoopTimerCallback :
public vtkCommand
416 static ExitMainLoopTimerCallback* New ()
418 return (
new ExitMainLoopTimerCallback);
421 Execute (vtkObject*,
unsigned long event_id,
void* call_data)
override;
424 vtkRenderWindowInteractor *interactor;
427 struct ExitCallback :
public vtkCommand
429 static ExitCallback* New ()
431 return new ExitCallback;
434 Execute (vtkObject*,
unsigned long event_id,
void*)
override;
452 compute (PolynomialFunction
const & p_function,
double val);
459 compute (RationalFunction
const & r_function,
double val);
468 computeHistogram (std::vector<double>
const & data,
int const nbins, std::vector<std::pair<double, double> > &histogram);
473 #include <pcl/visualization/impl/pcl_plotter.hpp>
void addHistogramData(std::vector< double > const &data, int const nbins=10, char const *name="Histogram", std::vector< char > const &color=std::vector< char >())
Bins the elements in vector data into nbins equally spaced containers and plots the resulted histogra...
Defines all the PCL implemented PointT point type structures.
void clearPlots()
Remove all plots from the window.
void setColorScheme(int scheme)
Set method for the color scheme of the plot.
void setViewInteractor(vtkSmartPointer< vtkRenderWindowInteractor > interactor)
Set the view's interactor.
void setWindowName(const std::string &name)
Set the visualizer window name.
int getColorScheme()
get the currently used color scheme
vtkSmartPointer< vtkRenderWindow > getRenderWindow()
Return a pointer to the underlying VTK RenderWindow used.
void setXRange(double min, double max)
Set logical range of the X-Axis in plot coordinates.
void setYRange(double min, double max)
Set logical range of the Y-Axis in plot coordinates.
shared_ptr< const PCLPlotter > ConstPtr
std::vector< double > PolynomialFunction
A representation of polynomial function.
PointCloud represents the base class in PCL for storing collections of 3D points.
double * getBackgroundColor()
set/get method for the viewport's background color.
void setWindowPosition(int x, int y)
Set the position in screen coordinates.
void renderOnce()
Render the vtkWindow once.
void addPlotData(PolynomialFunction const &p_function, double x_min, double x_max, char const *name="Y Axis", int num_points=100, int type=vtkChart::LINE, std::vector< char > const &color=std::vector< char >())
Adds a plot based on the given polynomial function and the range in X axis.
void startInteractor()
Initialize and Start the view's interactor.
bool addFeatureHistogram(const pcl::PCLPointCloud2 &cloud, const std::string &field_name, const int index, const std::string &id="cloud", int win_width=640, int win_height=200)
Add a histogram feature to screen as a separate window.
void addPlotData(char const *filename, int type=vtkChart::LINE)
Adds a plot based on a space/tab delimited table provided in a file.
void setShowLegend(bool flag)
Shows the legend of the graph.
void setBackgroundColor(const double r, const double g, const double b)
set/get method for the viewport's background color.
bool addFeatureHistogram(const pcl::PCLPointCloud2 &cloud, const std::string &field_name, 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.
void setYTitle(const char *title)
Set the title of the Y-Axis.
void plot()
Draws all the plots added by addPlotData() or addHistogramData() till now.
void setWindowSize(int w, int h)
set/get method for the window size.
void setXTitle(const char *title)
Set the title of the X-Axis.
void spin()
Spins (runs the event loop) the interactor indefinitely.
void addPlotData(std::vector< std::pair< double, double > > const &plot_data, char const *name="Y Axis", int type=vtkChart::LINE, std::vector< char > const &color=std::vector< char >())
Adds a plot with correspondences in vector of pairs.
void addPlotData(std::vector< double > const &array_x, std::vector< double >const &array_y, char const *name="Y Axis", int type=vtkChart::LINE, std::vector< char > const &color=std::vector< char >())
Adds a plot with correspondences in vectors arrayX and arrayY.
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 addPlotData(RationalFunction const &r_function, double x_min, double x_max, char const *name="Y Axis", int num_points=100, int type=vtkChart::LINE, std::vector< char > const &color=std::vector< char >())
Adds a plot based on the given rational function and the range in X axis.
std::pair< PolynomialFunction, PolynomialFunction > RationalFunction
A representation of rational function, defined as the ratio of two polynomial functions.
PCLPlotter(char const *name="PCL Plotter")
PCL Plotter constructor.
void addPlotData(double(*function)(double), double x_min, double x_max, char const *name="Y Axis", int num_points=100, int type=vtkChart::LINE, std::vector< char > const &color=std::vector< char >())
Adds a plot based on a user defined callback function representing the function to plot.
void close()
Stop the interaction and close the visualizaton window.
bool wasStopped() const
Returns true when the user tried to close the window.
int * getWindowSize() const
set/get method for the window size.
void spinOnce(const int spin_time=1)
Spins (runs the event loop) the interactor for spin_time amount of time.
void setBackgroundColor(const double color[3])
set/get method for the viewport's background color.
shared_ptr< PCLPlotter > Ptr
void setTitle(const char *title)
Set the main title of the plot.