PCL点云库学习笔记(可视化)
可视化
四、PCLPlotter
4.1 绘制多项式
PCLPlotter提供了一个非常简单明了的图形绘制界面,可以在库中可视化各种重要的图,从多项式函数到直方图。
#include<vector>
#include<iostream>
#include<utility>
#include<pcl/visualization/pcl_plotter.h>
using namespace std;
int main()
{
//声明绘图对象
pcl::visualization::PCLPlotter * plotter = new pcl::visualization::PCLPlotter();
//多项式函数, y = x^2. Index of x^2 is 1, rest is 0
vector<double> func1(3, 0);//三项的多项式,分别为1,x,x^2
func1[2] = 1;//下标为2,第三项系数为1
//adding the polynomial func1 to the plotter with [-10, 10] as the range in X axis and "y = x^2" as title
plotter->addPlotData(func1, -10, 10, "y = x^2");
//display the plot, DONE!
plotter->plot();
return 0;
}
4.2 绘图的基本步骤
//1.定义一个绘图对象
pcl::visualization::PCLPlotter *plot