Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
76230b99
Commit
76230b99
authored
Mar 22, 2015
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added an example program for the new perspective_window object.
parent
932243a0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
3d_point_cloud_ex.cpp
examples/3d_point_cloud_ex.cpp
+48
-0
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