MCPcopy Create free account
hub / github.com/davisking/dlib / main

Function main

examples/3d_point_cloud_ex.cpp:19–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17// ----------------------------------------------------------------------------------------
18
19int main()
20{
21 // Let's make a point cloud that looks like a 3D spiral.
22 std::vector<perspective_window::overlay_dot> points;
23 dlib::rand rnd;
24 for (double i = 0; i < 20; i+=0.001)
25 {
26 // Get a point on a spiral
27 dlib::vector<double> val(sin(i),cos(i),i/4);
28
29 // Now add some random noise to it
30 dlib::vector<double> temp(rnd.get_random_gaussian(),
31 rnd.get_random_gaussian(),
32 rnd.get_random_gaussian());
33 val += temp/20;
34
35 // Pick a color based on how far we are along the spiral
36 rgb_pixel color = colormap_jet(i,0,20);
37
38 // And add the point to the list of points we will display
39 points.push_back(perspective_window::overlay_dot(val, color));
40 }
41
42 // Now finally display the point cloud.
43 perspective_window win;
44 win.set_title("perspective_window 3D point cloud");
45 win.add_overlay(points);
46 win.wait_until_closed();
47}
48
49// ----------------------------------------------------------------------------
50

Callers

nothing calls this directly

Calls 5

colormap_jetFunction · 0.85
get_random_gaussianMethod · 0.80
overlay_dotClass · 0.50
push_backMethod · 0.45
add_overlayMethod · 0.45

Tested by

no test coverage detected