Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
76230b99
Commit
76230b99
authored
Mar 22, 2015
by
Davis King
Browse files
Added an example program for the new perspective_window object.
parent
932243a0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
examples/3d_point_cloud_ex.cpp
examples/3d_point_cloud_ex.cpp
+48
-0
examples/CMakeLists.txt
examples/CMakeLists.txt
+1
-0
No files found.
examples/3d_point_cloud_ex.cpp
0 → 100644
View file @
76230b99
// The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt
/*
This is an example illustrating the use of the perspective_window tool
in the dlib C++ Library. It is a simple tool for displaying 3D point
clouds on the screen.
*/
#include <dlib/gui_widgets.h>
#include <dlib/image_transforms.h>
using
namespace
dlib
;
// ----------------------------------------------------------------------------------------
int
main
()
{
// Let's make a point cloud that looks like a 3D spiral.
std
::
vector
<
perspective_window
::
overlay_dot
>
points
;
dlib
::
rand
rnd
;
for
(
double
i
=
0
;
i
<
20
;
i
+=
0.001
)
{
// Get a point on a spiral
dlib
::
vector
<
double
>
val
(
sin
(
i
),
cos
(
i
),
i
/
4
);
// Now add some random noise to it
dlib
::
vector
<
double
>
temp
(
rnd
.
get_random_gaussian
(),
rnd
.
get_random_gaussian
(),
rnd
.
get_random_gaussian
());
val
+=
temp
/
20
;
// Pick a color based on how far we are along the spiral
rgb_pixel
color
=
colormap_jet
(
i
,
0
,
20
);
// And add the point to the list of points we will display
points
.
push_back
(
perspective_window
::
overlay_dot
(
val
,
color
));
}
// Now finally display the point cloud.
perspective_window
win
;
win
.
set_title
(
"perspective_window 3D point cloud"
);
win
.
add_overlay
(
points
);
win
.
wait_until_closed
();
}
// ----------------------------------------------------------------------------
examples/CMakeLists.txt
View file @
76230b99
...
@@ -31,6 +31,7 @@ ENDMACRO()
...
@@ -31,6 +31,7 @@ ENDMACRO()
#here we apply our macros
#here we apply our macros
add_example
(
3d_point_cloud_ex
)
add_example
(
bayes_net_ex
)
add_example
(
bayes_net_ex
)
add_example
(
bayes_net_from_disk_ex
)
add_example
(
bayes_net_from_disk_ex
)
add_example
(
bayes_net_gui_ex
)
add_example
(
bayes_net_gui_ex
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment