Skip to content

Commit

Permalink
Use strongly typed 'enum' instead of 'int' for properties in PCLVisua…
Browse files Browse the repository at this point in the history
…lizer code
  • Loading branch information
root authored and root committed Nov 27, 2022
1 parent 58f9cfb commit 1d9340d
Show file tree
Hide file tree
Showing 77 changed files with 438 additions and 334 deletions.
4 changes: 2 additions & 2 deletions apps/cloud_composer/src/items/cloud_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ void
pcl::cloud_composer::CloudItem::paintView (pcl::visualization::PCLVisualizer::Ptr vis) const
{
vis->addPointCloud (cloud_blob_ptr_, geometry_handler_, color_handler_, origin_, orientation_, getId ().toStdString ());
vis->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, properties_->getProperty ("Point Size").toDouble (), getId ().toStdString ());
vis->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_OPACITY, properties_->getProperty ("Opacity").toDouble (), getId ().toStdString ());
vis->setPointCloudRenderingProperties (pcl::visualization::RenderingProperties::PCL_VISUALIZER_POINT_SIZE, properties_->getProperty ("Point Size").toDouble (), getId ().toStdString ());
vis->setPointCloudRenderingProperties (pcl::visualization::RenderingProperties::PCL_VISUALIZER_OPACITY, properties_->getProperty ("Opacity").toDouble (), getId ().toStdString ());

}

Expand Down
4 changes: 3 additions & 1 deletion apps/src/face_detection/filesystem_face_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ run(pcl::RFFaceDetectorTrainer& fdrf,
handler_votes(votes_cloud, "intensity");
vis.addPointCloud<pcl::PointXYZI>(votes_cloud, handler_votes, "votes_cloud");
vis.setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 14, "votes_cloud");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_POINT_SIZE,
14,
"votes_cloud");
}

vis.addCoordinateSystem(0.1, "global");
Expand Down
12 changes: 9 additions & 3 deletions apps/src/face_detection/openni_face_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,17 @@ run(pcl::RFFaceDetectorTrainer& fdrf, bool heat_map = false, bool show_votes = f
votes_cloud, 255, 0, 0);
vis.addPointCloud<pcl::PointXYZ>(votes_cloud, handler_votes, "votes_cloud");
vis.setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 14, "votes_cloud");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_POINT_SIZE,
14,
"votes_cloud");
vis.setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_OPACITY, 0.5, "votes_cloud");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_OPACITY,
0.5,
"votes_cloud");
vis.setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_OPACITY, 0.75, "votes_cloud");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_OPACITY,
0.75,
"votes_cloud");
}

std::vector<Eigen::VectorXf> heads;
Expand Down
8 changes: 6 additions & 2 deletions apps/src/ni_agast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,13 @@ class AGASTDemo {
if (!cloud_viewer_.updatePointCloud(keypoints3d, blue, "keypoints"))
cloud_viewer_.addPointCloud(keypoints3d, blue, "keypoints");
cloud_viewer_.setPointCloudRenderingProperties(
visualization::PCL_VISUALIZER_POINT_SIZE, 20, "keypoints");
visualization::RenderingProperties::PCL_VISUALIZER_FONT_SIZE,
20,
"keypoints");
cloud_viewer_.setPointCloudRenderingProperties(
visualization::PCL_VISUALIZER_OPACITY, 0.5, "keypoints");
visualization::RenderingProperties::PCL_VISUALIZER_OPACITY,
0.5,
"keypoints");
}
}

Expand Down
8 changes: 6 additions & 2 deletions apps/src/ni_brisk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,13 @@ class BRISKDemo {
if (!cloud_viewer_.updatePointCloud(keypoints3d, blue, "keypoints"))
cloud_viewer_.addPointCloud(keypoints3d, blue, "keypoints");
cloud_viewer_.setPointCloudRenderingProperties(
visualization::PCL_VISUALIZER_POINT_SIZE, 10, "keypoints");
visualization::RenderingProperties::PCL_VISUALIZER_POINT_SIZE,
10,
"keypoints");
cloud_viewer_.setPointCloudRenderingProperties(
visualization::PCL_VISUALIZER_OPACITY, 0.5, "keypoints");
visualization::RenderingProperties::PCL_VISUALIZER_OPACITY,
0.5,
"keypoints");
}

cloud_viewer_.spinOnce();
Expand Down
8 changes: 5 additions & 3 deletions apps/src/ni_linemod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ class NILinemod {
// Else, draw it on screen
// cloud_viewer_.addPolygon (region, 1.0, 0.0, 0.0, "region");
// cloud_viewer_.setShapeRenderingProperties
// (visualization::PCL_VISUALIZER_LINE_WIDTH, 10, "region");
// (visualization::RenderingProperties::PCL_VISUALIZER_LINE_WIDTH, 10, "region");

PlanarRegion<PointT> refined_region;
pcl::approximatePolygon(region, refined_region, 0.01, false, true);
Expand All @@ -449,7 +449,9 @@ class NILinemod {
static_cast<std::size_t>(refined_region.getContour().size()));
cloud_viewer_.addPolygon(refined_region, 0.0, 0.0, 1.0, "refined_region");
cloud_viewer_.setShapeRenderingProperties(
visualization::PCL_VISUALIZER_LINE_WIDTH, 10, "refined_region");
visualization::RenderingProperties::PCL_VISUALIZER_LINE_WIDTH,
10,
"refined_region");

// Draw in image space
image_viewer_.addPlanarPolygon(
Expand Down Expand Up @@ -485,7 +487,7 @@ class NILinemod {
0.0,
cube_name);
cloud_viewer_.setShapeRenderingProperties(
visualization::PCL_VISUALIZER_LINE_WIDTH, 10, cube_name);
visualization::RenderingProperties::PCL_VISUALIZER_LINE_WIDTH, 10, cube_name);

// ...and 2D
image_viewer_.addRectangle(search_.getInputCloud(), *object);
Expand Down
8 changes: 6 additions & 2 deletions apps/src/ni_susan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,13 @@ class SUSANDemo {
if (!cloud_viewer_.updatePointCloud(keypoints, blue, "keypoints"))
cloud_viewer_.addPointCloud(keypoints, blue, "keypoints");
cloud_viewer_.setPointCloudRenderingProperties(
visualization::PCL_VISUALIZER_POINT_SIZE, 20, "keypoints");
visualization::RenderingProperties::PCL_VISUALIZER_POINT_SIZE,
20,
"keypoints");
cloud_viewer_.setPointCloudRenderingProperties(
visualization::PCL_VISUALIZER_OPACITY, 0.5, "keypoints");
visualization::RenderingProperties::PCL_VISUALIZER_OPACITY,
0.5,
"keypoints");
}
}

Expand Down
8 changes: 6 additions & 2 deletions apps/src/ni_trajkovic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,13 @@ class TrajkovicDemo {
if (!cloud_viewer_.updatePointCloud(keypoints, blue, "keypoints"))
cloud_viewer_.addPointCloud(keypoints, blue, "keypoints");
cloud_viewer_.setPointCloudRenderingProperties(
visualization::PCL_VISUALIZER_POINT_SIZE, 10, "keypoints");
visualization::RenderingProperties::PCL_VISUALIZER_POINT_SIZE,
10,
"keypoints");
cloud_viewer_.setPointCloudRenderingProperties(
visualization::PCL_VISUALIZER_OPACITY, 0.5, "keypoints");
visualization::RenderingProperties::PCL_VISUALIZER_OPACITY,
0.5,
"keypoints");
}
}

Expand Down
88 changes: 59 additions & 29 deletions apps/src/openni_organized_edge_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class OpenNIOrganizedEdgeDetection {
viewer->setSize(640, 480);
viewer->addPointCloud<PointT>(cloud, "cloud");
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "cloud");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_POINT_SIZE, 1, "cloud");
viewer->addCoordinateSystem(0.2f, "global");
viewer->initCameraParameters();
viewer->registerKeyboardCallback(&OpenNIOrganizedEdgeDetection::keyboard_callback,
Expand All @@ -71,43 +71,63 @@ class OpenNIOrganizedEdgeDetection {
const int point_size = 2;
viewer->addPointCloud<PointT>(cloud, "nan boundary edges");
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_POINT_SIZE,
pcl::visualization::RenderingProperties::PCL_VISUALIZER_POINT_SIZE,
point_size,
"nan boundary edges");
viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_COLOR,
0.0f,
0.0f,
1.0f,
"nan boundary edges");
viewer->setPointCloudRenderingProperties(
pcl::visualization::RenderingProperties::PCL_VISUALIZER_IMMEDIATE_RENDERING,
0.0f,
0.0f,
1.0f,
"nan boundary edges");

viewer->addPointCloud<PointT>(cloud, "occluding edges");
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_POINT_SIZE, point_size, "occluding edges");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_POINT_SIZE,
point_size,
"occluding edges");
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_COLOR, 0.0f, 1.0f, 0.0f, "occluding edges");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_COLOR,
0.0f,
1.0f,
0.0f,
"occluding edges");

viewer->addPointCloud<PointT>(cloud, "occluded edges");
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_POINT_SIZE, point_size, "occluded edges");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_POINT_SIZE,
point_size,
"occluded edges");
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_COLOR, 1.0f, 0.0f, 0.0f, "occluded edges");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_COLOR,
1.0f,
0.0f,
0.0f,
"occluded edges");

viewer->addPointCloud<PointT>(cloud, "high curvature edges");
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_POINT_SIZE,
pcl::visualization::RenderingProperties::PCL_VISUALIZER_POINT_SIZE,
point_size,
"high curvature edges");
viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_COLOR,
1.0f,
1.0f,
0.0f,
"high curvature edges");
viewer->setPointCloudRenderingProperties(
pcl::visualization::RenderingProperties::PCL_VISUALIZER_COLOR,
1.0f,
1.0f,
0.0f,
"high curvature edges");

viewer->addPointCloud<PointT>(cloud, "rgb edges");
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_POINT_SIZE, point_size, "rgb edges");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_POINT_SIZE,
point_size,
"rgb edges");
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_COLOR, 0.0f, 1.0f, 1.0f, "rgb edges");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_COLOR,
0.0f,
1.0f,
1.0f,
"rgb edges");

return viewer;
}
Expand All @@ -120,43 +140,53 @@ class OpenNIOrganizedEdgeDetection {
switch (event.getKeyCode()) {
case '1':
viewer->getPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_OPACITY, opacity, "nan boundary edges");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_OPACITY,
opacity,
"nan boundary edges");
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_OPACITY,
pcl::visualization::RenderingProperties::PCL_VISUALIZER_OPACITY,
1.0 - opacity,
"nan boundary edges");
break;
case '2':
viewer->getPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_OPACITY, opacity, "occluding edges");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_OPACITY,
opacity,
"occluding edges");
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_OPACITY,
pcl::visualization::RenderingProperties::PCL_VISUALIZER_OPACITY,
1.0 - opacity,
"occluding edges");
break;
case '3':
viewer->getPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_OPACITY, opacity, "occluded edges");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_OPACITY,
opacity,
"occluded edges");
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_OPACITY,
pcl::visualization::RenderingProperties::PCL_VISUALIZER_OPACITY,
1.0 - opacity,
"occluded edges");
break;
case '4':
viewer->getPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_OPACITY,
pcl::visualization::RenderingProperties::PCL_VISUALIZER_OPACITY,
opacity,
"high curvature edges");
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_OPACITY,
pcl::visualization::RenderingProperties::PCL_VISUALIZER_OPACITY,
1.0 - opacity,
"high curvature edges");
break;
case '5':
viewer->getPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_OPACITY, opacity, "rgb edges");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_OPACITY,
opacity,
"rgb edges");
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_OPACITY, 1.0 - opacity, "rgb edges");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_OPACITY,
1.0 - opacity,
"rgb edges");
break;
}
}
Expand Down
8 changes: 5 additions & 3 deletions apps/src/openni_organized_multi_plane_segmentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ class OpenNIOrganizedMultiPlaneSegmentation {
cloud, 0, 255, 0);
viewer->addPointCloud<PointT>(cloud, single_color, "cloud");
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "cloud");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_POINT_SIZE, 1, "cloud");
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_OPACITY, 0.15, "cloud");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_OPACITY, 0.15, "cloud");
viewer->addCoordinateSystem(1.0, "global");
viewer->initCameraParameters();
return viewer;
Expand Down Expand Up @@ -180,7 +180,9 @@ class OpenNIOrganizedMultiPlaneSegmentation {
contour, red[i], grn[i], blu[i]);
viewer->addPointCloud(contour, color, name);
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 4, name);
pcl::visualization::RenderingProperties::PCL_VISUALIZER_POINT_SIZE,
4,
name);
}
prev_models_size = regions.size();
cloud_mutex.unlock();
Expand Down
4 changes: 3 additions & 1 deletion apps/src/openni_uniform_sampling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ class OpenNIUniformSampling {
if (!viz.updatePointCloud<pcl::PointXYZ>(keypoints_, "keypoints")) {
viz.addPointCloud<pcl::PointXYZ>(keypoints_, "keypoints");
viz.setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 5.0, "keypoints");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_POINT_SIZE,
5.0,
"keypoints");
viz.resetCameraViewpoint("keypoints");
}
}
Expand Down
8 changes: 5 additions & 3 deletions apps/src/organized_segmentation_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ displayPlanarRegions(
if (!viewer->updatePointCloud(contour, color, name))
viewer->addPointCloud(contour, color, name);
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 5, name);
pcl::visualization::RenderingProperties::PCL_VISUALIZER_POINT_SIZE, 5, name);
}
}

Expand All @@ -72,7 +72,7 @@ displayEuclideanClusters(const pcl::PointCloud<PointT>::CloudVectorType& cluster
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 5, name);
viewer->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_OPACITY, 0.3, name);
pcl::visualization::RenderingProperties::PCL_VISUALIZER_OPACITY, 0.3, name);
}
}

Expand Down Expand Up @@ -449,7 +449,9 @@ OrganizedSegmentationDemo::timeoutSlot()
vis_->addPointCloudNormals<PointT, pcl::Normal>(
prev_cloud_.makeShared(), prev_normals_.makeShared(), 10, 0.05f, "normals");
vis_->setPointCloudRenderingProperties(
pcl::visualization::PCL_VISUALIZER_OPACITY, 0.5, "normals");
pcl::visualization::RenderingProperties::PCL_VISUALIZER_OPACITY,
0.5,
"normals");
}
else {
vis_->removePointCloud("normals");
Expand Down
Loading

0 comments on commit 1d9340d

Please sign in to comment.