本文整理汇总了C++中PCLVisualizer::removeAllShapes方法的典型用法代码示例。如果您正苦于以下问题:C++ PCLVisualizer::removeAllShapes方法的具体用法?C++ PCLVisualizer::removeAllShapes怎么用?C++ PCLVisualizer::removeAllShapes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PCLVisualizer
的用法示例。
在下文中一共展示了PCLVisualizer::removeAllShapes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onUpdate
void ObjectDetectionViewer::onUpdate(PCLVisualizer& visualizer) {
Table::Collection tables;
Object::Collection objects;
{
mutex::scoped_lock(resultMutex);
tables = this->detectedTables;
objects = this->detectedObjects;
}
visualizer.removeAllShapes();
char strbuf[20];
int tableId = 0;
for (std::vector<Table::Ptr>::iterator table = tables->begin(); table != tables->end(); ++table) {
sprintf(strbuf, "table%d", tableId++);
visualizer.addPolygon<Point>((*table)->getConvexHull(), 255, 0, 0, strbuf);
}
int objectId = 0;
for (std::vector<Object::Ptr>::iterator object = objects->begin(); object != objects->end(); ++object) {
sprintf(strbuf, "object%d", objectId++);
visualizer.addPolygon<Point>((*object)->getBaseConvexHull(), 0, 255, 0, strbuf);
}
// TODO: print processing time in lower left corner (together with FPS)
}
示例2: updateViewer
void updateViewer (ORROctree& octree, PCLVisualizer& viz, std::vector<ORROctree::Node*>::iterator leaf)
{
viz.removeAllShapes();
const float *b = (*leaf)->getBounds (), *center = (*leaf)->getData ()->getPoint ();
float radius = 0.1f*octree.getRoot ()->getRadius ();
// Add the main leaf as a cube
viz.addCube (b[0], b[1], b[2], b[3], b[4], b[5], 0.0, 0.0, 1.0, "main cube");
// Get all full leaves intersecting a sphere with certain radius
std::list<ORROctree::Node*> intersected_leaves;
octree.getFullLeavesIntersectedBySphere(center, radius, intersected_leaves);
char cube_id[128];
int i = 0;
// Show the cubes
for ( std::list<ORROctree::Node*>::iterator it = intersected_leaves.begin () ; it != intersected_leaves.end () ; ++it )
{
sprintf(cube_id, "cube %i", ++i);
b = (*it)->getBounds ();
viz.addCube (b[0], b[1], b[2], b[3], b[4], b[5], 1.0, 1.0, 0.0, cube_id);
}
// Get a random full leaf on the sphere defined by 'center' and 'radius'
ORROctree::Node *rand_leaf = octree.getRandomFullLeafOnSphere (center, radius);
if ( rand_leaf )
{
pcl::ModelCoefficients sphere_coeffs;
sphere_coeffs.values.resize (4);
sphere_coeffs.values[0] = rand_leaf->getCenter ()[0];
sphere_coeffs.values[1] = rand_leaf->getCenter ()[1];
sphere_coeffs.values[2] = rand_leaf->getCenter ()[2];
sphere_coeffs.values[3] = 0.5f*(b[1] - b[0]);
viz.addSphere (sphere_coeffs, "random_full_leaf");
}
}