MCPcopy Create free account
hub / github.com/PointCloudLibrary/pcl / main

Function main

visualization/test/test.cpp:6–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4using Point = pcl::PointXYZRGB;
5
6int
7 main (int argc, char **argv)
8{
9 if (argc < 2)
10 {
11 std::cerr << "Needs a PCD file as input." << std::endl;
12 return (-1);
13 }
14
15 srand (time (0));
16
17 pcl::PointCloud<Point>::Ptr cloud (new pcl::PointCloud<Point>);
18
19 pcl::PCDReader pcd;
20 if (pcd.read (argv[1], *cloud) == -1)
21 return (-1);
22
23 pcl::visualization::PCLVisualizer p ("test");
24 p.setBackgroundColor (1, 1, 1);
25
26 // Handler random color demo
27 {
28 std::cerr << "PointCloudColorHandlerRandom demo." << std::endl;
29 pcl::visualization::PointCloudColorHandlerRandom<Point> handler (cloud);
30
31 p.addPointCloud<Point> (cloud, "cloud_random"); // no need to add the handler, we use a random handler by default
32 p.spin ();
33 p.removePointCloud ("cloud_random");
34
35 p.addPointCloud (cloud, handler, "cloud_random");
36 p.spin ();
37 p.removePointCloud ("cloud_random");
38 }
39
40 // Handler custom demo
41 {
42 std::cerr << "PointCloudColorHandlerCustom demo." << std::endl;
43 pcl::visualization::PointCloudColorHandlerCustom<Point> handler (cloud, 255, 0, 0);
44
45 p.addPointCloud (cloud, handler); // the default id is "cloud"
46 p.spin ();
47 p.removePointCloud (); // the default id is "cloud"
48
49 handler = pcl::visualization::PointCloudColorHandlerCustom<Point> (cloud, 255, 0, 0);
50 p.addPointCloud (cloud, handler, "cloud");
51 p.spin ();
52 p.removePointCloud ("cloud");
53 }
54
55 // Handler RGB demo
56 {
57 std::cerr << "PointCloudColorHandlerRGBField demo." << std::endl;
58 pcl::visualization::PointCloudColorHandlerRGBField<Point> handler (cloud);
59
60 p.addPointCloud (cloud, handler, "cloud_rgb");
61 p.spin ();
62 p.removePointCloud ("cloud_rgb");
63 }

Callers

nothing calls this directly

Calls 9

removePointCloudMethod · 0.80
addCoordinateSystemMethod · 0.80
resetStoppedFlagMethod · 0.80
readMethod · 0.45
setBackgroundColorMethod · 0.45
spinMethod · 0.45
addPointCloudMethod · 0.45
wasStoppedMethod · 0.45
spinOnceMethod · 0.45

Tested by

no test coverage detected