Exemplo n.º 1
0
void visualize(pcl::PointCloud<pcl::PointXYZ>::Ptr pCloud, pcl::visualization::PCLVisualizer::Ptr pVisualizer)
{
    //init visualizer
	pVisualizer->setSize(640, 480);
	pVisualizer->setPosition(640, 0);
	pVisualizer->setBackgroundColor(0x00, 0x00, 0x00);
	pVisualizer->initCameraParameters();
	pVisualizer->addPointCloud(pCloud, "cloud");

	//reload visualizer content
	pVisualizer->spinOnce(1000000);
}
    virtual void processBufferElement(CloudConstPtr cloud) override {
        cloud_viewer_->spinOnce();

        if (!cloud_viewer_->updatePointCloud(cloud, "OpenNICloud")) {
            cloud_viewer_->setPosition(0, 0);
            cloud_viewer_->setSize(cloud->width, cloud->height);
            cloud_viewer_->addPointCloud(cloud, "OpenNICloud");
            cloud_viewer_->resetCameraViewpoint("OpenNICloud");
            cloud_viewer_->setCameraPosition(
                    0, 0, 0,        // Position
                    0, 0, 1,        // Viewpoint
                    0, -1, 0);    // Up
        }

        // TODO; Figure out how to achieve this
//        if(cloud_viewer_->wasStopped()) {
//            this->cloud_buffer_.reset(new Buffer<CloudConstPtr>());
//            this->stop();
//            cloud_viewer_->close();
//        }
    }